DT::datatable giving error in R presentation

I am trying to use DT::datatable within an r presentation however it is producing the error

Error in file(con, "rb") : cannot open the connection

Can DT::datatable be used in R presentations?

Code to reproduce

test
========================================================
author: 
date: 
autosize: true

Slide With Code
========================================================

```{r}
library(DT)
Test <- data.frame(A=rnorm(30),B=rnorm(30),C=rnorm(30),D=rnorm(30))
datatable(Test)

--- input mssing backticks here

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] DT_0.13           jqmpp_1.0         scales_1.1.0      data.table_1.12.8

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6      digest_0.6.25     R6_2.4.1          jsonlite_1.6.1    lifecycle_0.2.0   magrittr_1.5      rlang_0.4.6       curl_4.3          remotes_2.1.1     tools_4.0.2      
[11] htmlwidgets_1.5.1 munsell_0.5.0     crosstalk_1.1.0.1 yaml_2.2.1        compiler_4.0.2    colorspace_1.4-1  htmltools_0.4.0  

RStudio Version 1.2.5042

your code produces working output for me when I paste it into a new notebook and click to preview

Hi @nirgrahamuk; thanks for your reply. I can confirm that the code works in other format, however, I am trying to get this to work in a presentation (in rstudio; File > New File > R Presentation).

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