Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knitr::kable is not rendered in the output of a chunk in R 3.5.0 #1353

Closed
chenyenchung opened this issue May 17, 2018 · 10 comments
Closed

knitr::kable is not rendered in the output of a chunk in R 3.5.0 #1353

chenyenchung opened this issue May 17, 2018 · 10 comments
Labels
RStudio IDE concerns the rstudio ide
Milestone

Comments

@chenyenchung
Copy link

chenyenchung commented May 17, 2018

After upgrading to R 3.5.0 and RStudio 1.1.453, chunk output with knitr::kable() is no longer rendered but kept as raw markdown.

  • This happens in the output below a chunk and preview of R Notebook:

2018-05-17 2 36 46

  • While the result of knit to html is fine.

The output used to be like this in R 3.4.3:
old_r

It looks like this now:
r3 5

On my machine, the minimal example is to open a new Rmarkdown or R Notebook file in RStudio, and run this chunk:

```{r}
knitr::kable(iris)
```

I also tried {r results='asis'} and installed development version of rmakrdown with devtools::install_github("rstudio/rmarkdown"), but neither of them fixed the issue.

asis

Thank you so much for all the help! If there's any thing else I could test, please let me know. This issue happened on a machine with the session info as below:

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16     digest_0.6.15    withr_2.1.2      rprojroot_1.3-2 
 [5] R6_2.2.2         jsonlite_1.5     backports_1.1.2  magrittr_1.5    
 [9] git2r_0.21.0     evaluate_0.10.1  highr_0.6        httr_1.3.1      
[13] stringi_1.2.2    curl_3.2         rmarkdown_1.9.12 devtools_1.13.5 
[17] tools_3.5.0      stringr_1.3.1    yaml_2.1.19      compiler_3.5.0  
[21] base64enc_0.1-3  memoise_1.1.0    htmltools_0.3.6  knitr_1.20  
@yihui
Copy link
Member

yihui commented May 17, 2018

Duplicate of #1331 (I think).

@yihui yihui marked this as a duplicate of #1331 May 17, 2018
@chenyenchung
Copy link
Author

chenyenchung commented May 17, 2018

Hello,
Sorry for the duplication. I guess I was carried away with the paged thingy and did not notice the similarity. One minor thing is that the display issue I encountered is also in Rmarkdown, slightly different from the description in #1331.
I am sorry for opening an redundant issue. Thank you so much for your patience and timely reply!

@yihui
Copy link
Member

yihui commented May 17, 2018

No worries. Actually I only suspect it is a duplicate. According to rstudio/rstudio#2748 (comment), the current version of RStudio must have fixed the issue. Could you try that? Thanks!

@chenyenchung
Copy link
Author

chenyenchung commented May 17, 2018

Currently in RStudio 1.1.453 the kable remains displayed as raw markdown on my machine.

new

I tested on another machine with current version of RStudio and R 3.4.2, the rendering is fine (session info below):

# Before upgrade
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_3.4.2  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2 htmltools_0.3.6
[6] tools_3.4.2     yaml_2.1.18     Rcpp_0.12.16    stringi_1.1.7   rmarkdown_1.9  
[11] highr_0.6       knitr_1.20      stringr_1.3.0   digest_0.6.15   evaluate_0.10.1

Installing R 3.5.0 breaks the rendering, so I feel this is somewhat reproducible.

# After upgrade
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0    yaml_2.1.19    highr_0.6      knitr_1.20

@yihui yihui reopened this May 17, 2018
@yihui yihui added the RStudio IDE concerns the rstudio ide label May 17, 2018
@yihui yihui added this to the v1.10 milestone May 17, 2018
@yihui
Copy link
Member

yihui commented May 17, 2018

@kevinushey @jmcphers I feel this is a issue similar to #1331, and the fix in the IDE might be similar, too. Could you take a look at it when you have a chance? Thanks!

@kevinushey
Copy link
Contributor

kevinushey commented May 17, 2018

This is indeed another manifestation of that same bug (changes in S3 dispatch behavior breaking RStudio). We attempt to assign our override here:

https://github.com/rstudio/rstudio/blob/1951f6427261e37ce165e2a14f68904a235345dd/src/cpp/session/modules/NotebookData.R#L126-L136

but we need to use @jmcphers's new solution in this space as well.

@33Vito
Copy link

33Vito commented May 28, 2018

I am having the same issue with R 3.5.0 and Rstudio 1.1.453 - kable produces either raw HTML or raw markdown.

I found a temporary workaround using the kable_styling function from the kableExtra package. i.e.

  • kable(head(mtcars)) produces raw html
  • kable_styling(kable(head(mtcars))) produces rendered table in both Rstudio and the associated R notebook.

Hope this would be fixed soon!

@jmcphers
Copy link
Member

This is fixed the dailies as well as in RStudio 1.1.455 (not yet released). You can try the latter here:

http://s3.amazonaws.com/rstudio-dailybuilds/RStudio-1.1.455.dmg

@chenyenchung
Copy link
Author

Thank you so much for the timely fix. I just downloaded the new version of RStudio, and tables are rendered perfectly now.

@github-actions
Copy link

github-actions bot commented Nov 3, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
RStudio IDE concerns the rstudio ide
Projects
None yet
Development

No branches or pull requests

5 participants