Thank you. At least now it seems to be running. I have a new error:
@andresrcs Can you help? (Grateful newbie)
Thank you. At least now it seems to be running. I have a new error:
@andresrcs Can you help? (Grateful newbie)
This error typically occurs with read.csv() if the file you are attempting to load is not in the same working directory as the RMarkdown file. Or similarly if the path is not set correctly. Or if the file name isn't quite right.
What is the specific line of code at (and around) line 145?
Hmmm... Maybe a few lines before that? I'm looking for the read.csv() function call. Where does data
get assigned (that you then use in line 150)?
Weird. Are you sure the error is still occurring on line 145? And, maybe you could upload all of the file because I'm still not seeing where you originally load data
?
If you put the data within an R chunk within the response, people on this site can see, copy and then test your code.
@bloosmore
Thanks but this is a proprietary code and I don't feel comfortable loading the whole code onto a public forum. Is there anything else you can recommend?
Your problem seems to be that you are skipping the part where you load "data" into memory. Have in mind that when you knit a file, the code gets executed in a clean environment so it is not going to have access to the data you already have in your current working environment, you have to explicitly include all the code needed to load the data from scratch.
Actually, the better way to go about this is not to share your actual code but to make a minimal REPRoducible EXample (reprex) representative of your issue.
BTW, I splited this thread into a new topic just for the sake of keeping things tidy. Topics should contained only a single reasonably well defined question or issue.
Understood. Somewhere above that code is a line that says something like data <- read.csv("foobar.csv")
or similar. My guess is that the error you're seeing indicates R can't find "foobar.csv". If that's right, you could either:
getwd()
and run just that chunk to confirm that R is looking in correct directory. If not, you could use setwd()
to change it. Make sure you do this in the RMarkdown file, not from the console.
From console:
That can be a tough error to debug. It generally means you're attempting to access a function like a vector or data frame (using the []
), but in your case, I wonder if it's not related to the previous data loading issue.
R doesn't seem to like the expression: raw_fusion$Sample ID
. First, what is stored in Sample ID
? Make sure that's what you expect. Then you might make sure raw_fusion$Sample ID
is extracting the column you intend.
Can you create a small version of this code the reproduces the error, with the data included, with possibly just a few 'dummy' rows of data since I know it's proprietary? This is the reprex mentioned earlier. Otherwise it will be difficult to help you debug this.
Me again.
Seem to be doing ok with RMarkdown and knitting until finalizing the pdf. Here is the error:
Any ideas where I need to look or what i need to do?
Unfortunately I don't. I usually knit to html, not pdf. Seems like it's a Latex error. Possibly something related to the figure labels. But it's hard to tell without the code.
Following R's error message, what does the log file show? You might comment out that specific figure to verify that's where the issue lies.
It is possible that this error happens because you are using a special character somewhere. In your figure label for example. Can you check this ?
@cderv
I can't see any unusual characters. The log shows:
These are the lines which use "label" in the .tex
You seem to have an _
in one of the label. Underscore are not well supported for that in LaTeX. Can you try by replacing it ?
@cderv
With some help, we have managed to run the script but we have had to remove a line of the code. I was hoping someone could tell me (in simple terms) what the code does!
knit: (function(inputFile, encoding) { rmarkdown::render(inputFile, encoding = encoding, output_file = file.path(dirname(inputFile), paste(format(Sys.time(), '%Y-%m-%d-%H-%M'),'_Sarcoma_Analysis&Graphs.pdf')) )})
I suppose this was in YAML ?
This is a way to change the behavior of the Knit button in the RSTUDIO IDE by using a custom render with some parameter. It only apply when you knit with the button.
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.