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.
- The first, Download your packages form the CRAN R , from the cran select and download the package you want to install.
- 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...
- Select the .ZIP or .TAR.GZ file that you downloaded
- If successful, the R console will give a message package 'twitteR' successfully unpacked and MD5 sums checked.
Installing R Packages directly from CRAN repositoryWhen 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
After the installation process are completed, load the package to the R session
library(twitteR)Two packages are installed and running to the R session, It’s so simple right?
Installing R Packages from GITHUBAside 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
Running the command install_github(package, username) or install_github(username/package)
install_github("ggplot2", "wch")Or, To install two or more packages in one command
Thanks for visitng my blog,
Happy Learning !