I want to dump the contents of a text file inside my R markdown (rmd). I tried using the R command: system("cat a.csv"). This command show the file contents in R, but produces no output when I knit the file in R studio.
我想在R markdown(rmd)中转储文本文件的内容。我尝试使用R命令:system(“cat a.csv”)。此命令在R中显示文件内容,但在R studio中编织文件时不生成输出。
1 个解决方案
#1
9
You can use either
你可以使用其中之一
```{r engine='bash', comment=''}
cat a.csv
```
or
```{r comment=''}
cat(readLines('a.csv'), sep = '\n')
```
The former solution requires Bash. The latter one is pure R.
前一种解决方案需要Bash。后者是纯粹的R.
#1
9
You can use either
你可以使用其中之一
```{r engine='bash', comment=''}
cat a.csv
```
or
```{r comment=''}
cat(readLines('a.csv'), sep = '\n')
```
The former solution requires Bash. The latter one is pure R.
前一种解决方案需要Bash。后者是纯粹的R.