R Basic Learning (1): R overview

Source: Internet
Author: User

R is a software system with statistical analysis and powerful graphing capabilities, and is co-founded by Ross Ihaka and Robert Gentleman. It is a free, free, source-code software that belongs to the GNU system, and is also an excellent tool for statistical computing and statistical mapping.

I. Development history of R
To say R, you have to talk about the S language first. Around 1980, the T-Bell Laboratory designed an S language widely used in the field of statistics. s language is an interpretive language designed to be used for data exploration, statistical analysis, and mapping.

The original implementation version of the S language is mainly S-plus, which is a business software based on S language, which is further perfected by the Department of Statistical Science of Mathsoft Corporation. Later, Robert Gentleman of Auckland University and Ross Ihaka and other volunteers developed an R system.

R is a GNU project based on the S language, so it can also be used as an implementation of the S language, which means that code written in the S language can run without modification in the R environment. Because of this, some people say that R is a "clone" of S-plus.

Ii. main functions of R
R is not only a software, but also a language, it is a complete set of data processing, computing and mapping software system.

The main functions of R include: data storage and processing, array operation, statistical analysis, statistical mapping and so on. In addition, it provides a simple and powerful programming language that manipulates data input and output for branching, looping, and user-defined functions.

third, the download and installation of R
The installation file for R supports multiple platforms, i.e. we can use R on Windows,linux or Mac OS x.

The download URL for the R installation package is: https://cran.r-project.org/. Click on the link to go to the page shown in 1.


Figure 1 Display page of the R installation package

As we can see from Figure 1, the installation package for R supports Windows,linux and Mac OS x three platforms. You can choose the corresponding installation package according to the system you are using.

The author uses the Windows system, so click on "Download R for Windows" in Figure 1 to see the page shown in 2.


Figure 2 Overview of the R installation package under the Windows platform

As you can see from Figure 2, the installation package for R is divided into the base package (base), the contribution package (contrib), and the Toolkit (rtools). For beginners, using the base package is sufficient. When you want to learn more about R, download the contribution Pack (contrib) and Toolkit (Rtools).

Click "Base" in Figure 2 to go to the download page shown in 3.


Figure 3 download page for the R installation package

Click "Download r 3.2.3 for Windows" in Figure 3 to download the basic installation package for R.

After the installation package is downloaded, double-click to start the installation. Follow the installation prompts to install R on your computer and create a shortcut on your desktop at a step-by-step procedure.

The first entry to the R software is shown in interface 4.


Figure 4 Interface of the R software

As you can see from Figure 4, the R default command prompt is ">", which indicates that the command is waiting for input.

Iv. Fundamentals of R
Before we learn r, let's look at how R works.

We know that in programming languages like C, C + +, Java, we have to construct a complete program form when we use them, but it doesn't work to enter a single command, but R is not. Because R is an interpreted language rather than a compiled language, it means that the input commands can be executed directly without first forming a complete program form. The syntax of R is also very simple and intuitive.

When R is running, all variables, data, functions, and results are present in the computer's active memory as objects (objects), with the corresponding name code. We can manipulate these objects by using some operators, such as arithmetic, logic, comparison, and some functions.

As for functions in R, we can graphically describe them in figure 5来.


Figure 5 Functions of R

The parameters in Figure 5 (arguments) may be some objects (such as data, equations, formulas, etc.), some parameters in the function is preset to the default value, the user can be modified as necessary, so the operation of an R function may not need to set any parameters, because all parameters can be default to the defaults, Of course, it is possible that the function itself does not contain any parameters.

The specific operating principle of R 6 is shown.


Figure 6 How R works

As you can see from Figure 6, all operations performed in R are for objects stored in active memory. The input and output of data, results, or graphs is achieved by reading and writing files on the hard disk of the computer. The user can enter some commands to invoke the function, the results of the analysis may be displayed directly on the screen, or can be stored in an object or written to the hard disk. Because the resulting result is an object in itself, they can also be treated as data and analyzed as normal data. Data files can be read from a local disk or transmitted over a network from the remote server side.

All available R functions are included in a library, which is placed in the R_home/library directory of the disk (R_home is the address of the installation R, as the author's library directory is: D:\Program files\r\r-3.2.3\library )。 This directory contains packages with various functions (packages), which are organized in the same way as directories.

In all packages, a package named base is the core of R, because it embeds all the basic functions of the R language like data read-write and manipulation. Within each package, there is a subdirectory R, and this directory contains a file with the same name as the package (for example, in package base, there is a file r_home/library/base/r/base), which is where all functions are stored.

R Basic Learning (1): R overview

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.