我的sharelatex文档:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{comment}
\begin{document}
<<echo=FALSE, cache=FALSE>>=
read_chunk("mycodeTesting.R")
@
The code must show up here
<<myrcode1>>=
@
\end{document}我的名为"mycodeTesting.R“的R代码文件,我已经上传到我的Sharelatex目录:
## ---- myrcode1
load("/Users/Name/Desktop/Statistics/DF1.Rda")
load("/Users/Name/Desktop/Statistics/DF2.Rda")
DF1_Test <- DF1
DF2$ID <- as.numeric(DF2$ID)
colnames(DF1)[14]<- "Patent Sum"
colnames(DF2)[14]<- "Patent Sum"如您所见,我的R代码加载了大量预先保存在数据帧(R.da)中的数据。
但是,我的Sharelatex会生成以下错误:
load("/Users/Name/Desktop/Statistics/DF1.Rda")
## Warning in readChar(con, 5L, useBytes = TRUE): cannot open compressedfile ’/Users/Name/Desktop/Statistics/DF1.Rda’, probablereason ’No such file or directory’
## Error in readChar(con, 5L, useBytes = TRUE): cannot open the connection我怎样才能上传这些数据帧,这样sharelatex才能通过knitr检索它们呢?
发布于 2018-06-09 23:34:11
我设法解决了我自己的问题。我正在写解决方案,以防其他人遇到类似的问题。
解决方案非常简单,只需将.Rda数据帧上传到我的Sharelatex目录,然后指定load命令:
load("DF1.Rda")然后,它能够加载数据并生成代码,而不会出现错误。
https://stackoverflow.com/questions/50775059
复制相似问题