How to Install and Include an R Package
This article is originally published at https://blog.datazar.com/tagged/r-language?source=rss----e2c7e6e1c75--r_language
We get a lot of questions about the usage of R libraries. The most common question is “can I use all the R libraries in your notebooks/consoles?”
Yes! You can use any of the libraries that have been published to the R package repository (CRAN).
Open up your notebook/console:
1. Install
install.packages("ggplot2") this will install the package if it hasn’t already been installed.
2. Include
library(ggplot2) this will call/include the library into your session.
3. Use
ggplot(data=iris,aes(x=Sepal.Length,y=Petal.Length))+geom_point()
Remember, when installing packages, you have to use quote marks inside the install.packages("") function but not when including them using the library().
Once libraries are installed, you don’t have to install them again. You can just call them with library() and then use them as you wish.
Link to notebook: https://www.datazar.com/file/f105230b5-0a2f-4976-af08-db1b00f793a4
How to Install and Include an R Package was originally published in Datazar Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.
Thanks for visiting r-craft.org
This article is originally published at https://blog.datazar.com/tagged/r-language?source=rss----e2c7e6e1c75--r_language
Please visit source website for post related comments.