R FAQS: R Packages
Question: What is an R Package?
Answer: R package is a collection of objects that R Language can use. A package contain functions, data set, and documentation (which helps how to use the package) or other objects such as dynamically loaded libraries of already compiled code.
Question: How do I see which packages I have available?
Answer: To see which packages you have use the command at R prompt
Question: Which packages do I already have?
Answer: To see what packages are installed one can use the installed.packages() command a R prompt. Output will show the packages installed.
Question: How one can load a Package in R language?
Answer: Basic packages are already loaded. If you want to load downloaded version of packages use the command
> library(“package name”)
where package name is the name of the package you want to load. Here in example we used the “car”, it means “car” package will be loaded.
Question: How one can see the documentation of a particular package?
Answer: To see the documentation of particular package use the command
> library(help=”package name”)
> help(package=”package name”)
for more information about getting help follow the link: Getting Help in R Language
Question: How do I see the help for a specific function?
Answer: To get help about a function in R use command
> help(“function name”)
> ? function name
Question: What functions and datasets are available in a package?
Answer: To check what functions and datasets are in a package using the help command at R prompt. This will provide package information giving list of functions and datasets.
Note that once a package is loaded, the help command can also be used with all available functions and datasets.
Question: How can one add or delete a package?
Answer: A package can be installed using command
> install.packages(“package name”)
and package can be removed or deleted using command
> remove.packages(“package name”)