I'm trying to get a table in a PDF using the knitr and kableExtra packages in R but when I compile the PDF the table code is in the PDF not a table. The screen shot below is from the example code provided. The PDF was 11 pages so I only included the first page as an example of the compiled PDF output. I am using knitr and pdfLaTeX. The last time I ran my code in 2021 there were no issues. My code is not provided - just an example, but I'm having the same issues with my code. enter image description here

Example code:






R session info:

R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] kableExtra_1.3.4 knitr_1.39       openxlsx_4.2.5   plyr_1.8.6       DBI_1.1.2        odbc_1.3.3      
[7] lattice_0.20-45 

loaded via a namespace (and not attached):
 [1] zip_2.2.0         Rcpp_1.0.8        compiler_4.1.2    tools_4.1.2       digest_0.6.29    
 [6] bit_4.0.4         viridisLite_0.4.0 evaluate_0.15     lifecycle_1.0.1   pkgconfig_2.0.3  
[11] rlang_1.0.2       cli_3.2.0         rstudioapi_0.13   xfun_0.30         fastmap_1.1.0    
[16] httr_1.4.2        stringr_1.4.0     xml2_1.3.3        systemfonts_1.0.4 vctrs_0.3.8      
[21] hms_1.1.1         webshot_0.5.3     bit64_4.0.5       grid_4.1.2        svglite_2.1.0    
[26] glue_1.6.2        R6_2.5.1          rmarkdown_2.14    blob_1.2.3        magrittr_2.0.2   
[31] scales_1.2.0      ellipsis_0.3.2    htmltools_0.5.2   rvest_1.0.2       colorspace_2.0-3 
[36] stringi_1.7.6     munsell_0.5.0 

2 Answers 2


Obviously, restart the computer is not the solution. The solution is stop asking not to include the table with include=F (with F of FALSE). So, remove this option, or change it to the default (include=T or include=TRUE). Then it work as expected:



I restarted my computer and now everything seems to be working correctly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.