【问题标题】:Error when trying to knit html in R markdown [duplicate]尝试在 R markdown 中编织 html 时出错 [重复]
【发布时间】:2016-02-20 17:01:17
【问题描述】:

以下是我得到的错误:

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

感谢您的帮助

【问题讨论】:

  • 请不要将install.packages(…)代码放在Rmd文档中。大多数人都想管理自己的包库。

标签: r markdown knitr


【解决方案1】:

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

options(repos="https://cran.rstudio.com" )

在您的代码中。顺便说一句,在针织代码中你可能应该

  • 运行install.packages()(正如@hrbrmstr 在评论中所说,“[m] 大多数人都想管理自己的包库”)
  • 致电setwd() 手动设置您的工作目录

【讨论】:

  • cmets 在技术上不是为了“谢谢”——如果你想表达你的感激之情,请接受答案(点击复选标记)和/或投票
  • 问题不是knitr使用“非交互模式”,而是因为没有涉及到RStudio。见scoa's answer here
猜你喜欢
  • 2017-03-01
  • 1970-01-01
  • 2020-07-02
  • 2021-08-14
  • 1970-01-01
  • 2021-12-18
  • 2018-05-26
  • 1970-01-01
  • 2017-08-27
相关资源
最近更新 更多