R within Rstudio cannot find rmarkdown package
markdown, r, rstudio
Solution
Try running this code to get the latest version of the rmarkdown package, which should solve the issue:
install.packages("rmarkdown", repos = "https://cran.revolutionanalytics.com")
The issue is that the RStudio IDE looks at a static CRAN snapshot that was taken before the rmarkdown package was updated. For more information, see this link: https://groups.google.com/forum/#!topic/rropen/Kgg8z6FF40I
Problem
I am trying to use rmarkdown, within Rstudio (0.98.953) on a PC, for the first time. I have upgraded to the latest versions of R (3.1.1) and R studio. The output from sessionInfo() is provided at the end of this question. As I understand it rmarkdown should be included within Rstudio. However, when I select to create a markdown document in Rstudio, a dialog box pops up saying additional packages need to be installed. The installation of rmarkdown always then fails, with the following message: ``` Installing package into '\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win-library/3.1' (as 'lib' is unspecified) * installing *source* package 'rmarkdown' ... ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded *** arch - i386 Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) : there is no package called 'rmarkdown' Error: loading failed Execution halted *** arch - x64 Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) : there is no package called 'rmarkdown' Error: loading failed Execution halted ERROR: loading failed for 'i386', 'x64' * removing '\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win- library/3.1/rmarkdown' Warning messages: 1: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/R" CMD INSTALL -l "\\cfsk18.campus.gla.ac.uk\SSD_Home_Data_X\jm383x\My Documents\R\win-library\3.1" "C:/PROGRA~1/RStudio/R/packages/rmarkdown_0.2.49_047a80058bb4ef0b142196013d1c4dd8870d4dd9.tar.gz"' had status 1 2: In utils::install.packages("C:/Program Files/RStudio/R/packages/rmarkdown_0.2.49_047a80058bb4ef0b142196013d1c4dd8870d4dd9.tar.gz", : installation of package 'C:/PROGRA~1/RStudio/R/packages/rmarkdown_0.2.49_047a80058bb4ef0b142196013d1c4dd8870d4dd9.tar.gz' had non-zero exit status ``` I assume this is something to do with using a managed desktop in my place of work. However this is not usually a problem as far fewer restrictions are placed on these machines than is usually the case, and all other packages, software etc tend to work. I have also tried installing rmarkdown directly from github. Again the installer cannot identify the package rmarkdown itself. What is likely to be the cause of the error? SessionInfo output: ``` R version 3.1.1 (2014-07-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_3.1.1 ``` Attempt to install directly from github repo: ``` devtools::install_github("rstudio/rmarkdown") Installing github repo rmarkdown/master from rstudio Downloading master.zip from https://github.com/rstudio/rmarkdown/archive/master.zip Installing package from C:\Users\jm383x\AppData\Local\Temp\RtmpINmLRv/master.zip Installing rmarkdown Installing dependencies for rmarkdown: httpuv Installing package into ‘\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win-library/3.1’ (as ‘lib’ is unspecified) trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/httpuv_1.3.0.zip' Content type 'application/zip' length 857357 bytes (837 Kb) opened URL downloaded 837 Kb package ‘httpuv’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\jm383x\AppData\Local\Temp\RtmpINmLRv\downloaded_packages "C:/PROGRA~1/R/R-31~1.1/bin/x64/R" --vanilla CMD INSTALL \ "C:\Users\jm383x\AppData\Local\Temp\RtmpINmLRv\devtoolscec10833677\rmarkdown-master" \ --library="\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win- library/3.1" --install-tests * installing *source* package 'rmarkdown' ... ** R ** inst ** tests ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded *** arch - i386 Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) : there is no package called 'rmarkdown' Error: loading failed Execution halted *** arch - x64 Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) : there is no package called 'rmarkdown' Error: loading failed Execution halted ERROR: loading failed for 'i386', 'x64' * removing '\\cfsk18.campus.gla.ac.uk/SSD_Home_Data_X/jm383x/My Documents/R/win- library/3.1/rmarkdown' ```