Rmarkdown not reading data when knitting

Hi everyone,
so I would love to use RMarkdown to get a document with code and output in it straightaway.
Nevertheless, when I try to knit in HTML format seems like RMarkdown doesn't recognize the .csv file with my data.
The first chunk of my RMarkdown is a simple exploration of the data:

##Summary of dataset

(ndr I've put the # to preventing the website from reading the code as an r code and outputting it without the shifted quotation marks and the {r}. Additionally, csvdataset is a name that I just invented to explain the problem, is not the actual name of the file)

The error I get is:

Error in summary(csvdataset) : object 'csvdataset' not found.
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> summary Execution halted

Same happens when I try with another chunk of my code.
In Rstudio everything works fine and csvdataset is present in the global environment.
Additionally, I have already set my directory in a folder where the .csv file is there simply by doing in the console the usual code:


when I do str(csvdataset) it says, as expected, "data.frame"

Hopefully I've explained myself clearly enough.
If you need anything else, just tell me.

You have to include the code to read the csv file into a data frame.


Thank you very much Andres!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.