My sharelatex document:

\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}

My R code file named "mycodeTesting.R", which I've uploaded to my Sharelatex directory:

## ---- 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"

As you can see, my R code is loading a lot of data that is presaved in dataframes (R.da).

However, my Sharelatex generates errors saying:

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

In what way can I upload these dataframes so sharelatex can retrieve them through knitr?

1

There are 1 answers

0
WoeIs On

I managed to solve my own question. I'm writing the solution in case somebody else has a similar problem.

The solution was as simple as to just upload the .Rda data frames to my Sharelatex directory and then specify the load command as such:

load("DF1.Rda")

Then it's able to load the data and generate the codes without errors.