R Studio with R Markdown

First I don't think a reproducible code will be necessary, it is not my code that is the problem; rather I completed a number of blocks of code (for homework), then I attempted to knit them. I want to use R Markdown and knit to a pdf, I am new to R and basically my first serious attempt to use markdown. A classmate advised I take the entire code, block by block ...let's just work with the command to pull data from a .gov website: library(RCurl)
library(jsonlite)
urltoRead <- "http://opendata.maryland.gov/api/views/pdvh-tf2u/rows.json?accessType=DOWNLOAD"
apiUrl <- getURL(urltoRead)
jData <- fromJSON(apiUrl)
mlanddf <- data.frame(jData[[2]]), I run this succesfully, and by calling mllandf said classmate showed me this {r...}, in order to get it into Rmd. I have done so, but now the only block of code that reveals an output is the data loaded from the URL, when I try running the next block (just removing some unwanted columns form the .gov data, there is no output displayed (in the console), doing so with the next block (changing column names) reveals no output either. My code worked fine 24 hours ago, and other than creating these {r ...} for each block I have changed nothing. Clicking on the knit icon and selecting knit to pdf generates "line 14, error in eval (expr, envir,enclos): object'mlanddf' not found callshandle -> withCallingHandlers ->with visible -> eval -> eval Execution halted. Line 14: #Step2remove 8 columns (yep, just a comment), followed by line 15:
mlanddf <- mlanddf[,-1:-8]. ANybody know why the blocks will not display output now?

Even if it's true that your code is not the problem, a reproducible example would help us to diagnose what the actual problem is, so, please provide a REPRoducible EXample (reprex) illustrating your issue.

I am a beginner in R, too and I had some issues with knitting my code like you have.
My solution was to brush empty console, plots and environment and then run the whole code to check for errors.
In your case I suspect that somehow the generation of the object mlanddf is not possible. When you run your code you will hopefully get an error message with more information about what is happening there.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.