12

I'm having multiple problems with R right now but I want to start asking one of the most fundamental questions.

I want to install GitHub files into R, but for some reason the install_github function doesn't seem to exist. For example, when I type:

install_github("devtools")

I get

error: could not find function install_github

The install_packages function worked perfectly fine. How can I solve this problem?

To add, I want to ask whether there is a way to upgrade R, since version 2.15.2 doesn't seem to be compatible for most of the packages I want to work with.

I'm currently using Linux version 3.6.11-1 RedHat 4.7.2-2 fedora linux 17.0 x86-64.

I checked the CRAN website but they seemed to have the most unupdated versions of R (if that is even possible) that dates all the way back to '09. I would seriously love to update myself from this old version of R. Any advice on this too?

Thomas
  • 43,637
  • 12
  • 109
  • 140
AliciaC
  • 121
  • 1
  • 1
  • 3

2 Answers2

22

install_github is a function of the devtools package. You have to install and load devtools before using install_github:

install.packages("devtools")
library("devtools")
install_github("youruser/yourrepo")
sgibb
  • 25,396
  • 3
  • 68
  • 74
  • Thanks! I followed you advice and the message I get is package ‘devtools’ is not available (for R version 2.15.2). What must I do? I already downloaded the tar.gz for devtools in multiples of versions. – AliciaC Apr 22 '14 at 09:37
  • @user3559745: I thought there must be a *devtools* version for 2.15. But you could install your downloaded tar.gz via commandline: `R CMD INSTALL devtools_versionXYZ.tar.gz` (or update your R, e.g. by building it from source). – sgibb Apr 22 '14 at 09:41
  • I tried R CMD INSTALL but my R just states "Error: unexpected symbol in "R CMD"." I actually did find devtools that supposedly works for my version of R, so tried installing that, and it turns out that I need further installing of 'httr,' 'RCurl,' 'memoise,' 'whisker,' 'evaluate.' So I began looking for httr that suits my version of R and am not getting lucky so far. httr provided by CRAN website only seems to support R with versions higher than 3.0. What can I do? – AliciaC Apr 22 '14 at 10:03
  • @AliciaC: The easiest way would be to update your R. – sgibb Apr 22 '14 at 10:15
  • I'd love to update my R, but another problem lies there. I went to CRAN website and searched for updated versions of R for my linux server, but it turns out the most recent R there dates back to '09. I think I'm looking into the wrong websites for answers. Do you have any advice? Thanks. – AliciaC Apr 22 '14 at 10:27
  • I do not know anything about Redhat but why you don't try to build R from source? – sgibb Apr 22 '14 at 10:30
  • Actually, I'm sorta a newbee to this whole system so I don't really know where to get the sources for R... :( – AliciaC Apr 22 '14 at 10:40
  • @AliciaC: Sorry for this answer but there is a link on http://cran.r-project.org : http://cran.r-project.org/src/base/R-3/R-3.1.0.tar.gz – sgibb Apr 22 '14 at 10:47
1

Upgrading the R and R studio version will help.And then you need to install devtools before using install_github.

HOW TO UPGRADE R

# Update and Install
sudo apt-get update
sudo apt-get install r-base r-base-dev
#
# To update any R libraries installed via APT.
#
sudo apt-get upgrade

THEN INSTALL DEVTOOLS IN ORDER TO USE install_github()

install.packages("devtools")
library(devtools)
/* then */
install_github("your_package_name")
Community
  • 1
  • 1