library(data.table)
mydata <- data.table(A=c("a", "a", "b", "c", "c"), val=c(1:5))

renderPlot({
  # Works - see console for output
  print(eval(quote( mydata[A %in% c("a", "c")] )))

  # Error - see console for message
  print(evalq( mydata[A %in% c("a", "c")] ))

  # Error - see console for message
  print( mydata[A %in% c("a", "c")] )

  plot(1:3, 1:3) # Just an arbitrary plot
})


# All forms work fine in renderPrint
renderPrint({
  print(eval(quote( mydata[A %in% c("a", "c")] ))) # Works
  print(evalq( mydata[A %in% c("a", "c")] ))       # Works
  print( mydata[A %in% c("a", "c")] )              # Works
})


Try the rmarkdown package in your browser

Any scripts or data that you put into this service are public.

rmarkdown documentation built on Sept. 18, 2023, 5:17 p.m.