0

I'm trying to create an R Markdown report using some data I've uploaded, converted to a tbl and transposed.

As you can see in the following snapshot I know that R is reading the data because it appears under the ```{r} command.

enter image description here

However it is not rendering as a Markdown file and I receive the following error in the R Markdown Console:

Error in eval(expr, envir, enclose) : object 'Becas' not found Calls: ... handle -> withCallingHandlers -> with Visible -> eval -> eval Execution halted.

Any suggestions?

help-info.de
  • 6,695
  • 16
  • 39
  • 41
S.Evans
  • 1
  • 1
  • You did not load Becas... – Martin Schmelzer Jan 30 '17 at 17:29
  • Welcome to StackOverflow. My suspicion is that you are not loading the data within your markdown document. This is necessary as it starts a fresh R session when you run it. Please take a look at these tips on how to produce a [minimum, complete, and verifiable example](http://stackoverflow.com/help/mcve), as well as this post on [creating a great example in R](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Perhaps the following tips on [asking a good question](http://stackoverflow.com/help/how-to-ask) may also be worth a read. – lmo Jan 30 '17 at 17:29
  • Objects in the global environment won't be available to you when you knit to markdown. You must define `Becas` in an `r` block in your .Rmd file. This contrasts to just running code chunks without knitting, which *will* use global environment variables. – Simon Jackson Jan 30 '17 at 23:30
  • Thanks for the advice. As mentioned, I needed to upload and manipulate the data within the RMarkdown document in order for it to render. I thought I had tried that before asking, but it worked after a second try. – S.Evans Jan 31 '17 at 20:16

1 Answers1

0

It looks like you may be confusing the console session and the Rmarkdown document. I think you have loaded the Becas dataset in the Console as you can see it in the Environment panel at the top RHS.

Have a look at the History panel - in there you will probably find the commands you used to load the Becas dataset. (you could also look in the .Rhistory file in the directory where you started the rstudio session from). Copy the appropriate lines/commands from the history into the Rmarkdown document and try again.

Note that you should have a look around here to see how a good question is asked - that way we can help without guessing.

If you need more help, find your history of commands and paste them into your question.

PJP
  • 612
  • 1
  • 6
  • 18
  • Thanks for the advice. As mentioned, I needed to upload and manipulate the data within the RMarkdown document in order for it to render. I thought I had tried that before asking, but it worked after a second try. – S.Evans Jan 31 '17 at 20:16