Serendipity
Serendipity

Reputation: 69

How to download packages, Programming R

I have no idea how to open the file of the packages on programming R. For instance, when I download one of the Windows binaries of rgl from http://cran.r-project.org/web/packages/rgl/index.htm and I select R file of the downloaded zip file,using programming R, it does not work. How can I fix this problem?

Upvotes: 2

Views: 5736

Answers (1)

user3652621
user3652621

Reputation: 3634

R is command-line based. That means that every action taken by R has to be specified in a line of code, including downloading and loading packages.

To download a package, you would use

install.packages("packagename") 

Make sure there are no spaces between the quotation marks and the name, R can be very literal, so for instance " package" is different from "package" as it has an extra space. After you install a package you still cannot use it until you tell R to load it using one of:

library(packagename)
require(packagename)

Note that quote marks are no longer needed at this point. If this is all so very confusing, might want to give R Commander a try.

Upvotes: 6

Related Questions