尝试在R markdown中编织html时出错

时间:2016-02-20 17:01:18

标签: r markdown knitr

以下是我得到的错误:

Quitting from lines 46-48 (lesson3_student.rmd) 
Error in contrib.url(repos, "source") : 
  trying to use CRAN without setting a mirror
Calls: <Anonymous> ... withVisible -> eval -> eval -> install.packages -> contrib.url
In addition: Warning message:
In in_dir(opts_knit$get("root.dir") %n% input_dir(), evaluate::evaluate(code,  :
  You changed the working directory to /Users/Madiyar/Desktop/Facebook Data (probably via setwd()). It will be restored to /Users/Madiyar/Downloads. See the Note section in ?knitr::knit
Execution halted

感谢您的帮助

1 个答案:

答案 0 :(得分:2)

这个错误对我来说似乎很清楚;你"trying to use CRAN without setting a mirror";问题是针织在非交互模式下运行。试试

options(repos="https://cran.rstudio.com" )
你的代码中的

。我会说在编织代码中你应该

  • 运行install.packages()(正如@hrbrmstr在评论中所说,&#34; [m] ost人们想要管理他们自己的软件包库&#34;)
  • 致电setwd()手动设置工作目录