Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a package from source?

I'm trying to install an older version of the phylogenetics package "geiger" on R. I'm on a Windows XP machine. I've tried the following construction:

install.packages(C:\geiger_1.3-1.tar.gz, repos = NULL, type = "source")

And every permutation I can think of for it.

Does anyone have any ideas?

Edit: the error returned is:

Error: unexpected input in "install.packages(C:\"
like image 205
JTD Avatar asked Jun 08 '13 02:06

JTD


1 Answers

shouldn't you pass the file name as a string (or better yet w/ file.path)? e.g. install.packages(file.path("geiger_1.3-1.tar.gz"), repos = NULL, type = "source") Remember that installing packages you need to pass a string where loading libraries you can pass an unquoted name (or a string).

Responding to your comment here so I can have formatting

So you wrote install.packages(C:\Rfiles("geiger_1.3-1.tar.gz"), repos = NULL, type = "source"). Remember that the first argument to install.packages has to be a character vector. What you've passed in is C:\Rfiles("geiger_1.3-1.tar.gz") which isn't really anything. Take a look at help(file.path) and help(install.packages) to see some examples of how to specify the file path. In this specific case you should try:

g.path <- file.path("C:", "Rfiles", "geiger_1.3-1.tar.gz")
install.packages(g.path, repos = NULL, type = "source")

That's (as best as I can tell) the absolute path to your package, with no worrying about the backslash/forwardslash issue.

like image 154
Adam Hyland Avatar answered Sep 28 '22 15:09

Adam Hyland