Debian Codegraph @

tests/shiny/02-data-table.Rmd

raw
1 ---
2 output: html_document
3 runtime: shiny
4 ---
5
6 ```{r}
7 library(data.table)
8 mydata <- data.table(A=c("a", "a", "b", "c", "c"), val=c(1:5))
9
10 renderPlot({
11 # Works - see console for output
12 print(eval(quote( mydata[A %in% c("a", "c")] )))
13
14 # Error - see console for message
15 print(evalq( mydata[A %in% c("a", "c")] ))
16
17 # Error - see console for message
18 print( mydata[A %in% c("a", "c")] )
19
20 plot(1:3, 1:3) # Just an arbitrary plot
21 })
22
23
24 # All forms work fine in renderPrint
25 renderPrint({
26 print(eval(quote( mydata[A %in% c("a", "c")] ))) # Works
27 print(evalq( mydata[A %in% c("a", "c")] )) # Works
28 print( mydata[A %in% c("a", "c")] ) # Works
29 })
30 ```