Document does not knit

Hello everybody I have a problem with my RMD file. I am writing a document that I would love having in both HTML and pdf.

I have tried to convert it all to pdf but I always have the same error:

Version:1.0 StartHTML:0000000107 EndHTML:0000001464 StartFragment:0000000127 EndFragment:0000001446

processing file: hey.Rmd Error in parse_block(g[-1], g[1], params.src) : duplicate label 'Importing dataset' Calls: ... process_file -> split_file -> lapply -> FUN -> parse_block Execution halted

I decided to start a new document and to knit it everytime I added a chunk and I realized that the document knitted well until I arrived to this chunk.

data1 <- read_csv("lung.csv")

I am concerned because all the tables and graphs I need for my document come from this table and I do not know what to do. Please I would really appreciate your help.

Based on the error, it seems like you have labelled two code chunks with the same name "Importing dataset". knitr expects each chunk to have a unique label. Try changing the label ID for one of the duplicate chunk labels and re-knit.

Thank you very much for your help, indeed you were right. However, now I have another problem:

Version:1.0 StartHTML:0000000107 EndHTML:0000001656 StartFragment:0000000127 EndFragment:0000001638

output file: Error: Functions that produce HTML output found in document targeting latex output. Please change the output type of this document to HTML. Alternatively, you can allow HTML output in non-HTML formats by adding this option to the YAML front-matter of your rmarkdown file: always_allow_html: true Note however that the HTML output will not be visible in non-HTML formats. Execution halted

What can I do for exporting the file as a pdf. I can export it into an HTML file but not PDF and I have Miktex and Texmaker already installed on my laptop.

Thank you in advance for your help

in your yaml header, you want to have the option

output: pdf_document

if that doesn't work, simply opening the file as HTML, and then printing the HTML page as PDF through the browser is a good idea for a simple solution

This error means you have some content in your Rmd that produces HTML only content. Like htmlwidgets or else. If so, you can use as explained in the error message in your yaml header

always_allow_html: true
Note however that the HTML output will not be visible in non-HTML formats

Can you check about this HTML only content ?

1 Like

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