How to Install R Packages

Portal-Statistik |Today I will shared about R Application and R Packages, I think this tutorial for beginers only, not for master or professional programmer.

R is a powerfull application for analytics, R is open source software, all of people  can devlope it.
One of the reasons R Application to be very popular software is the availability of a package (collection of functions, data and code). Until now, there are more than 6 thousand R packages in CRAN repository. Not including packages provided by other sources. The packages number continues to growing from day-to-day exponentially.

If you installed R for the first time, only a few standard packages that come installed. So you must be install R packages as your need.

This tutorial, explain you step by step how to install R Packages.

Installing R packages from a local.

  1. The first, Download your packages form the CRAN R , from the cran select and download the package you want to install.
  2.  After downloaded your packages .ZIP or .TAR.GZ file, In GUI of R application select Packages Menu and choose install package(s) from local zip files...
  3.  Select the .ZIP or .TAR.GZ file that you downloaded
  4. If successful, the R console will give a message package 'twitteR' successfully unpacked and MD5 sums checked.

Installing R Packages directly from CRAN repository

When you're connected to the Internet, installing R packages can directly performed from the CRAN repository. The way is very simple , just use the command:
install.packages("pkgs")
"pkgs" is the package you want to install, package name is case-sensitive, you must be correct writing the name. For Example, you want to install twitter packages. You must be write
install.packages("twitteR")
Then select the CRAN mirror, for example, "Indonesia (Jakarta)". Same as installing packages from a local file, the R console will give a message package 'twitteR' successfully unpacked and MD5 sums checked.
 
To install two or more packages in one command, for example, twitteR and ggplot2 packages, just use the command
install.packages(c("twitteR", "ggplot2"))

After the installation process are completed, load the package to the R session
library(twitteR)
library(ggplot2)
Two packages are installed and running to the R session, It’s so simple right?

Installing R Packages from GITHUB

Aside from CRAN, we can also install the R package (usually the developer version) from GitHub using install_github () command. The command is on the devtools package. The following steps to install R package from GitHub:

The first, Install and load the devtools package into the R session
install.packages("devtools")
library(devtools)

Running the command install_github(package, username) or install_github(username/package)

For Example
install_github("wch/ggplot2")
OR
install_github("ggplot2", "wch")
Or, To install two or more packages in one command
install_github(c("geoffjentry/twitteR", "wch/ggplot2"))

Thanks for visitng my blog,
Good Luck
Happy Learning !

Tag : DataMining, R
0 Komentar untuk "How to Install R Packages"

Silahkan tinggalkan komentar, kritik, maupun saran dari sobat blogger tentang apa yang sobat rasakan setelah mengunjungi blog ini.

Back To Top