gpt4 book ai didi

r - 来自 linux 命令行的 Knitr

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:37:30 25 4
gpt4 key购买 nike

我有一个非常简单的 knitr 脚本。它与我的 Windows 笔记本电脑上的 rstudio 完美配合。

---
title: "Descriptives and PCA"
output:
pdf_document: default
html_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning=FALSE, message=FALSE)
```
#TEST

```{r}
print(getwd())
```

我使用以下脚本在 linux 集群上运行脚本

cd ./__workspace/R/pipeline
Rscript -e "library(knitr); stitch('pipelineDescriptive.Rmd')"

这是行不通的。它打印出一个 pdf,它只是 Rmd 文件代码的副本。

控制台打印出如下两个问题:

|................................                                 |  50%
label: auto-report
Error in parse(text = code, keep.source = FALSE) :
attempt to use zero-length variable name
|......................................... | 62%

Warning message:
In highr::hilight(x, format, prompt = options$prompt, markup = opts$markup) :
the syntax of the source code is invalid; the fallback mode is used

有没有人对如何解决这个问题有任何建议?

最佳答案

我建议使用 library(rmarkdown) 然后

Rscript -e "rmarkdown::render('pipelineDescriptive.Rmd')"

如果你想使用library(knitr):

Rscript -e "knitr::stitch_rmd('pipelineDescriptive.Rmd')"

关于r - 来自 linux 命令行的 Knitr,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47088518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com