rubenarslan / codebook

Cook rmarkdown codebooks from metadata on R data frames
https://rubenarslan.github.io/codebook/
Other
142 stars 16 forks source link

Empty html upon rendering Rmd with a codebook #46

Closed JanaJarecki closed 4 years ago

JanaJarecki commented 4 years ago

Hi, knitting the below Rmd file to HTML (copied from the tutorial) yields an empty HTML file without errors. The empty HTML occurs only for the codebook argument

   metadata_table = TRUE

and not otherwise

Specs: Windows 10 codebook_0.8.2 as well as the github version R version 3.6.3 (2020-02-29) Sublimetext (not R Studio)

Rmarkdown file that I render

    ---
    title: "Test"
    author: "JBJ"
    date: "yyyy-mm-dd"
    output:
      html_document:
        toc: true
        toc_depth: 4
        toc_float: true
        code_folding: 'hide'
    ---
    ```{r setup, include=FALSE}
      library(codebook)
      knitr::opts_chunk$set(warning = FALSE, message = TRUE, error = FALSE, echo = FALSE)
## Demonstrating is.prime

```{r test-this, echo = FALSE}
  old_base_dir <- knitr::opts_knit$get("base.dir")
  knitr::opts_knit$set(base.dir = tempdir())
  on.exit(knitr::opts_knit$set(base.dir = old_base_dir))
  data("bfi")
  bfi <- bfi[, c("BFIK_open_1", "BFIK_open_1")]
```

```{r codebook}
  codebook(bfi,
    survey_repetition = "single",
    metadata_table = TRUE              # <---- causes the empty HTML
)
```

**This is the console log**
There seems nothing wrong here AFAIS
```Bash
    output file: test.knit.md

    "DIR:/Users/your_user_name/AppData/Local/Pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash+smart --output test.html --email-obfuscation none --self-contained --standalone --section-divs --table-of-contents --toc-depth 4 --variable toc_float=1 --variable toc_selectors=h1,h2,h3,h4 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template  
    "DIR:\Users\your_user_name\Documents\R\win-library\3.6\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header
    "DIR:\Users\your_user_name\AppData\Local\Temp\RtmpIjYheO\rmarkdown-str64e045c43f64.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --lua-filter
    "DIR:/Users/your_user_name/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter
    "DIR:/Users/your_user_name/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable code_folding=hide --variable code_menu=1 

    Output created: test.html
    > 
    > 
    [Finished in 4.3s]
JanaJarecki commented 4 years ago

More info: Rendering the *.md file directly shows that the table seems to get mixed into the json data: image

rubenarslan commented 4 years ago

seems to be fixed in planned release (not yet on CRAN)