I can't solve error to knit :: Error in parse_block(g[-1], g[1], params.src) : duplicate label 'setup'

Hi,
This is my code..

I keep getting this error. (Error in parse_block(g[-1], g[1], params.src) : duplicate label 'setup')
I do not know why. If you know how to fix it, please help me. :disappointed_relieved::disappointed_relieved:

This error could appear if you named two chunks with the same name in your document. here it seems there are 2 chunks names setup.

Can you check in your Rmd document ?

I don't know if this is related, but I did not quite understand your printed screen : Are you calling render from inside another chunk? form another document ? The error may come from SEQprocess_Introduction.Rmd that also contains a setup chunk. Have to try to render the document from the console ? If you do that, have you still an error ?

4 Likes

I've fixed this issue. But this time 'Error in sink(con, split = debug) : sink stack is full' ..

This is all the relevant chunks of knit.

If you have any idea about this, can you help me?

sink is useful to divert the output of R somewhere. Here it seems to be a connection to a file con where the R output are diverted and if debug=TRUE, the output is also printed in the current stream (the console I think).

It seems there somewhere, it can't manage to deal with the sink stack in your case. You can try isolate the issue. It is difficult to know more from afar with just this screenshot.

Out of curiosity, did you try to render from the console with rmarkdown::render and not from another Rmd document ? It could help understand where this comes from

2 Likes

I had this same issue. I like to do all my evaluation at the top of my .R script, write what i need to in the middle (using what was evaluated above), and then print all the code chunks (with eval = FALSE) at the bottom when it is compiled (yes! you can render a md directly from R!). In order to ensure that markdown/spin does not think I have two code chunks named the same thing, I needed to put a line space #' in between the code chunks.

I've had both of these issues sequentially just as samantha had, and I'm not sure I totally understand the solution.

I was trying to finish an Rmd file with the render command to create an (in my case) Word document of the finished report. The reason I'm using the command render() instead of the Knit button is to manipulate where it stores my output file.

If I have the line render(rmdfile.Rmd) in my Rmd the process will recursively analyze the Rmd over and over again. If I have named chunks, the first error that it will print is the error of duplicate label with whatever the name of my first label is. If I do not have named chunks, it goes through the loop of rendering over and over again until the sink stack is full.

So, how do you write the command line render() if it can't be in your file?
My solution as of now is to comment out the render command, save the file, uncomment it, and then run it. But this seems awfully clunky.

Thanks for your input!