top

Search

R Programming Tutorial

R InstallationR is a very powerful tool for statistics, graphics, and statistical programming. It is quite popular and used by tens of thousands of people daily to perform serious statistical analyses, moreover, It is a free, open-source system having more than 2,000 available add-ons and many packages are coming almost every day.Downloading and Installing RWindows and OSX users can download R from CRAN - the “Comprehensive R Archive Network”. Linux and Unix users can install R packages using their package management tool:WindowsOpen https://cran.r-project.org in your browser. Click on “ Download R for Windows”First time user can choose “base”Click on the link for downloading the latest version of R (a .exe file). When the download completes, double-click on the .exe file and answer the usual questions. OSXOpen https://cran.r-project.org in your browser. Click on “Download R for Mac OS X”Click on the .pkg file for the latest version of R, under “Files:”, to download it. When the download completes, double-click on the .pkg file and answer the usual questions. Linux or Unix:-The major Linux distributions have packages for installing R. For example:DistributionPackage NameUbuntu or Debianr-baseRed Hat or FedoraR.i386SuseR-BaseUse the system’s package manager to download and install the package. Normally, you will need the root password or sudo privileges; otherwise, ask a system administrator to perform the installation.Installing R on Windows or OS X is quite straightforward as prebuilt binaries are available for those platforms. You need only to follow the preceding instructions. The CRAN Web pages also contain links to installation-related resources, such as frequently asked questions (FAQs) and tips for special situations.Theoretically, one can install R on Linux or Unix in one of two ways: by installing a distribution package or by building it from scratch. In practice, installing a package is the preferred route. The distribution packages greatly streamline both the initial installation and subsequent updates.On Ubuntu or Debian, use apt-get to download and install R. Run under sudo to have the necessary privileges:$ sudo apt-get install r-baseOn Red Hat or Fedora, one can use yum:$ sudo yum install R.i386Beyond the base package, installing the documentation package is also recommended. For example, one can install useful R-manuals locally by:$ sudo apt-get install r-base-html r-doc-htmlSome Linux repositories also include prebuilt copies of R packages available on CRAN.A very useful place to know more about the R installation and administration is: R Installation and administrationInstalling packages:-R has got a very rich collection of pre-built packages which help the practitioners to accomplish the job quite easily. Before one can start using the packages on the go, he has to install the package in the R-environment:The command for installing the packages in R-Environment:> install.packages(‘package name’)> library(package name)If someone wants to learn more detail about the ‘function’, the following commands can come really handy there:‘help’ – to display the documentation for the function> help(function name)‘args’ – for a quick reminder of the function arguments> args(function name)‘example’ – to see examples of using the function> example(function name)Searching the web for the help:Inside R, use the RSiteSearch function to search by keyword or phrase:> RSiteSearch(“key phrase”), and inside your browser, you can try exploring the following sites:Rseek.org - This is a Google custom search that is focused on R-specific websites.Stackoverflow - Stack Overflow is a searchable Q&A site oriented toward programming issues such as data structures, coding, and graphics.https://stats.stackexchange.com - The Statistical Analysis area on Stack Exchange is also a searchable Q&A site, but it is oriented more toward statistics than programming.Getting to know the useful librariesGiven the vast number (more than 2000!)of packages available in R, the problem of finding the most useful package may appear to be quite overwhelming. There are ways which could help someone in this scenario: A task view is a great place to start since you get an overview of what’s available. Suppose you happen to know the name of a useful package—say, by seeing it mentioned online. A complete, alphabetical list of packages is available at http://cran.r -project.org/web/packages/ with links to the package summary pages. You can download and install an R package called sos that provides powerful other ways to search for packages; see the vignette at https://cran.rproject.org/web/packages/sos/vignettes/sos.pdf.R-StudioR-studio is an application that makes using R much easier. Also, the RStudio interface looks the same for Windows, Mac OS, and Linux. You can download RStudio for free. Just click the “Download RStudio” button and follow the simple instructions that follow. Once you’ve installed RStudio, you can open it like any other program on your computer—usually by clicking an icon on your desktop.This module of the tutorial shares quick check-points to get start
Rated 5/5 based on 19 customer reviews
logo

R Programming Tutorial

R Installation

R is a very powerful tool for statistics, graphics, and statistical programming. It is quite popular and used by tens of thousands of people daily to perform serious statistical analyses, moreover, It is a free, open-source system having more than 2,000 available add-ons and many packages are coming almost every day.

Downloading and Installing R

Windows and OSX users can download R from CRAN - the “Comprehensive R Archive Network”. Linux and Unix users can install R packages using their package management tool:

Windows

  1. Open https://cran.r-project.org in your browser. 
  2. Click on “ Download R for Windows
  3. First time user can choose “base
  4. Click on the link for downloading the latest version of R (a .exe file). 
  5. When the download completes, double-click on the .exe file and answer the usual questions. 

OSX

  1. Open https://cran.r-project.org in your browser. 
  2. Click on “Download R for Mac OS X
  3. Click on the .pkg file for the latest version of R, under “Files:”, to download it. 
  4. When the download completes, double-click on the .pkg file and answer the usual questions. 

Linux or Unix:-

The major Linux distributions have packages for installing R. For example:

DistributionPackage Name
Ubuntu or Debianr-base
Red Hat or FedoraR.i386
SuseR-Base

Use the system’s package manager to download and install the package. Normally, you will need the root password or sudo privileges; otherwise, ask a system administrator to perform the installation.

Installing R on Windows or OS X is quite straightforward as prebuilt binaries are available for those platforms. You need only to follow the preceding instructions. The CRAN Web pages also contain links to installation-related resources, such as frequently asked questions (FAQs) and tips for special situations.

Theoretically, one can install R on Linux or Unix in one of two ways: by installing a distribution package or by building it from scratch. In practice, installing a package is the preferred route. The distribution packages greatly streamline both the initial installation and subsequent updates.

On Ubuntu or Debian, use apt-get to download and install R. Run under sudo to have the necessary privileges:

$ sudo apt-get install r-base

On Red Hat or Fedora, one can use yum:

$ sudo yum install R.i386

Beyond the base package, installing the documentation package is also recommended. For example, one can install useful R-manuals locally by:

$ sudo apt-get install r-base-html r-doc-html

Some Linux repositories also include prebuilt copies of R packages available on CRAN.

A very useful place to know more about the R installation and administration is: R Installation and administration

Installing packages:-

R has got a very rich collection of pre-built packages which help the practitioners to accomplish the job quite easily. Before one can start using the packages on the go, he has to install the package in the R-environment:

The command for installing the packages in R-Environment:

> install.packages(‘package name’)

> library(package name)

If someone wants to learn more detail about the ‘function’, the following commands can come really handy there:

‘help’ – to display the documentation for the function

> help(function name)

‘args’ – for a quick reminder of the function arguments

> args(function name)

‘example’ – to see examples of using the function

> example(function name)

Searching the web for the help:

Inside R, use the RSiteSearch function to search by keyword or phrase:

> RSiteSearch(“key phrase”), and inside your browser, you can try exploring the following sites:

Rseek.org - This is a Google custom search that is focused on R-specific websites.

Stackoverflow - Stack Overflow is a searchable Q&A site oriented toward programming issues such as data structures, coding, and graphics.

https://stats.stackexchange.com - The Statistical Analysis area on Stack Exchange is also a searchable Q&A site, but it is oriented more toward statistics than programming.

Getting to know the useful libraries

Given the vast number (more than 2000!)of packages available in R, the problem of finding the most useful package may appear to be quite overwhelming. There are ways which could help someone in this scenario: A task view is a great place to start since you get an overview of what’s available. Suppose you happen to know the name of a useful package—say, by seeing it mentioned online. A complete, alphabetical list of packages is available at http://cran.r -project.org/web/packages/ with links to the package summary pages. 

You can download and install an R package called sos that provides powerful other ways to search for packages; see the vignette at https://cran.rproject.org/web/packages/sos/vignettes/sos.pdf.

R-Studio

R-studio is an application that makes using R much easier. Also, the RStudio interface looks the same for Windows, Mac OS, and Linux. You can download RStudio for free. Just click the “Download RStudio” button and follow the simple instructions that follow. Once you’ve installed RStudio, you can open it like any other program on your computer—usually by clicking an icon on your desktop.

This module of the tutorial shares quick check-points to get start

Leave a Reply

Your email address will not be published. Required fields are marked *

Suggested Tutorials

C# Tutorial

By KnowledgeHut

C# is an object-oriented programming developed by Microsoft that uses the .Net Framework. It utilizes the Common Language Interface (CLI) that describes the executable code as well as the runtime environment. C# can be used for various applications such as web applications, distributed applications, database applications, window applications etc.For greater understanding of this tutorial, a basic knowledge of object-oriented languages such as C++, Java etc. would be beneficial.
Rated 5/5 based on 12 customer reviews
C# Tutorial

C# is an object-oriented programming developed by Microsoft that uses ...

Read More

Python Tutorial

By KnowledgeHut

Python Tutorial 
Rated 5/5 based on 11 customer reviews