【问题标题】:R-markdown cannot change working directory. Used to work properlyR-markdown 不能更改工作目录。用于正常工作
【发布时间】:2019-01-26 01:24:28
【问题描述】:

我有 R-markdown 代码,以前可以在我的笔记本电脑上正常工作。我刚刚运行我的代码并收到以下错误。我尝试重新安装 knitr 和 markdown 包,但问题仍然存在。这是错误:

无法更改工作目录 调用: ... withCallingHandlers -> withVisible -> eval -> eval -> setwd 执行停止

这是我的代码的前几行:

---
output: 
  html_document:
  toc: true
  number_sections: true
geometry: margin= 0in
include:
 after_body: footer.html
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r, echo=FALSE, warning = FALSE, message=FALSE}
#Edit theses values to change it throughout the report
county<-"Butler"
pubDate<- "June 2018"
citeDate<-"2013"
```
```{r, echo=FALSE, warning = FALSE, message=FALSE}

【问题讨论】:

  • 这不是一个完整的文档,但它在我的系统上运行良好。当您尝试编织您发布的内容时,您是否收到错误消息?
  • 是的,这是我编织成HTML后收到的错误信息。
  • 编织原始文档,还是您发布的片段?

标签: r r-markdown knitr


【解决方案1】:

我不确定发生了什么,但是当我重新运行代码时,我不再收到该错误。相反,我收到此错误:错误:必须提供符号或字符串作为参数。我认为我的代码的以下部分应该有问题:

  education.year <- acs %>% 
  filter(Sex == "Total", `Age Group`=="All", `County Name` == county) %>% 
  select(`6th Grade or Less`, `7th- 12th (No Diploma)`, `High School Graduate`, 
         `Some College`, `Bachelor's Degree`, `Graduate Degree`)  %>% 
  gather(c(`6th Grade or Less`, `7th- 12th (No Diploma)`, `High School Graduate`, 
           `Some College`, `Bachelor's Degree`, `Graduate Degree`), EduPerc) 

P.S:我的 Rmarkdown 代码曾经可以正常工作。

【讨论】:

    猜你喜欢
    • 2021-10-21
    • 2014-10-09
    • 1970-01-01
    • 2023-03-09
    • 2021-08-20
    • 1970-01-01
    • 1970-01-01
    • 2021-02-10
    • 1970-01-01
    相关资源
    最近更新 更多