Width of R code chunk output in RMarkdown files knitr-ed to html

前端 未结 3 2165
忘了有多久
忘了有多久 2020-12-30 05:39

Question:

What is the current working solution to set the width of r code output in html files? I would like to set width to something big and use a slider in the

3条回答
  •  死守一世寂寞
    2020-12-30 05:43

    You can use this to make the pre blocks scroll horizontally if it overflows.

    ---
    title: "Width test"
    output:
      html_document:
        theme: default
    ---
    
    
    
    ```{r global_options, echo = FALSE, include = FALSE}
    options(width = 999)
    knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE,
                          cache = FALSE, tidy = FALSE, size = "small")
    ```
    ```{r}
    sessionInfo()
    ```
    ```{r}
    dataM <- matrix(rnorm(100, 5, 2), ncol = 20)
    dataM
    ```
    


    For a scrollable height, create a container div with a max height and a overflow-y: auto; or overflow-y: scroll;

    Similar question/answer

    ---
    title: "Height test"
    output:
      html_document:
        theme: default
    ---
    
    
    
    
    ```{r} sessionInfo() ```

提交回复
热议问题