I have been stuck trying to call variables from my rscript file to my r markdown file for hours. They are in the global environment and I can see the data frames display in visual mode but it won't let me knit to html since it "cannot find the variable named".
On a similar note, when I try to call a variable inline with text
The number of goals scored isr goals_scored
it shows up as...
The number of goals scored is r goals_scored
with the only difference that the r code being surrounded by a rectangle.
De global environment is only available when you run the code interactively but when you knit an Rmd document the code gets executed in a clean environment other than the one you are currently working on so the mentioned data frame doesn't exist there. You need to include the necessary code to import the data frame into memory, in your Rmd document itself, for example, if the data frame comes from a csv file you would include something like this: your_data_frame <- read.csv("path_to_file.csv").
So the data frame I have is created through 300 lines of code in my r script file that also creates 20 more data frames. Is there a function I can call that will bring these data frames to my rmd file (since it's not in csv form)? Or do I need to move my 300 lines of code out of rscript and into a rmd?