Very new to R studio! I'm having an issue getting a .csv file into R studio. I have have included an image of the code I've used to insert the data but the data won't actually appear! Anyone know what I'm doing wrong?
I think the problem I'm having is that the variable will not display the csv table. Anyone know how to fix this?
It looks like you have this code in RMarkdown document in the setup chunk, which has the option include=FALSE
set. This means that you won't see output from that chunk.
You can learn more about how chunks work in RMarkdown here:
For example, here's the section on include
:
include
: Whether to include anything from a code chunk in the output document. Wheninclude = FALSE
, this whole code chunk is excluded in the output, but note that it will still be evaluated ifeval = TRUE
. When you are trying to setecho = FALSE
,results = 'hide'
,warning = FALSE
, andmessage = FALSE
, chances are you simply mean a single optioninclude = FALSE
instead of suppressing different types of text output individually.
I'd suggest only using the setup chunk for setting knitr options, etc., and then putting your other code in other chunks. When you create a new RMarkdown document, it usually has multiple chunks inside of it in the example document created. But, essentially, chunks are bound by three backticks (```) with the "engine" or language declared in the opening (this is better described in the section on R code chunks I linked to above:
```{r}
library(here)
library(tidyverse)
# etc. whatever code you want in here
```
You can also use the keyboard shortcut to insert a new chunk if you're working in RStudio.
For Windows and Linux: Ctrl+Alt+I
For Mac: Cmd+Option+I
Brilliant! Yes that has solved the problem. Thank you very much Mara. The video I watched actually specifically said to run that code in the template code chunk and it seemed to work for them which is strange.
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.