Introduction to R language

Source: Internet
Author: User

Suggest R and Rstudio!
The R language is composed of functions and assignments.
R uses <-(preferably a habit) rather than the traditional = as an assignment symbol. For example: X<-rnorm (5) (or Rnorm (5)->x) creates a vector object named X that contains 5 random deviations from a standard normal distribution.
R allows the use of = assignment, but it is not a standard syntax, and sometimes problems occur, not recommended.
There is also a third method of assignment: Assign ("J", 4). More trouble, but sometimes it is necessary!
Comments begin with # and any subsequent text will be ignored by the R interpreter.
Second, the Help statement in R:
Help.start (): Opens the Help document first page.
Help ("foo") or? Foo: Opens the helper document for function Foo. (quotation marks can be omitted)
Example ("foo"): use instance of function Foo. (quotation marks can be omitted)
Third, the function of managing R space:
GETWD (): Displays the current working directory.
SETWD ("C:/mydata"): Modifies the current working directory to MyData. Attention is "/"! (and temporarily change the working directory, when R is reopened, the working directory is restored to the default.) Once and for all the solution is to right-click R or Rstudio shortcut, change the starting position, such as my: Right-click rstudio--> start Position "E:\My-R-Data")
LS (): Lists the objects in the current workspace.
RM (ObjectList): Removes (deletes) one or more objects.
RM (List=ls ()) is the equivalent of clear in MATLAB, which indicates that all variables in the working environment are clear.
Source ("filename"): Executes a script. (quotation marks cannot be omitted!) You'll have to bring the file extension too! )
Four, R package
A package is a collection of r functions, data, and precompiled code in a well-defined format. The directory where the package is stored on the computer becomes a library.

Download pack: Install.packages ("_"), note that quotation marks cannot be omitted! You can also install multiple packages install.packages (C ("_", "_") at once.
Loading: library (_), without quotation marks. Every use once to load, trouble ~ ~

About the R language, I am now mainly looking at "R language Combat", this is a very good entry-level textbook! Now the second version has come out, more than the first version of the 200+ page.

Introduction to R language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.