How do I install packages in a ShareLatex knitr file (.Rtex)?? The R code
par(mfrow=c(1,1))
install.packages("tree")
library(tree)
model.tree.simpel <- tree(response~.,data=dat)
plot(model.tree.simpel)
text(model.tree.simpel)
Error message
Installing package into '/usr/local/lib/R/site-library'## (as 'lib' is unspecified)##
Warning in install.packages("tree"):
'lib = "/usr/local/lib/R/site-library"' is notwritable##
Error in install.packages("tree"): unable to install packages##
Error in library(tree): there is no package called 'tree'##
Error in eval(expr, envir, enclos): could not find function "tree"##
Error in plot(model.tree.simpel): object 'model.tree.simpel' not found##
Error in text(model.tree.simpel): object 'model.tree.simpel' not found
It seems like you cannot install packages but you can upload them. I use here the DPI
package as an example. It seems like the official sharelatex server runs on a linux x86_64 machine. So your packages need to be compiled on such a machine (eg ubunut 64)
~/R/x86_64-pc-linux-gnu-library/3.1/DPI
) DPI
folder in sharelatex DPI
folder in the sharelatex DPI
folder DPI
package with library(DBI)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.