0

I want to pass a predefined but empty data.frame to shiny/DT. Are there good practices?

What I found out is that

x <- data.frame(a=NA, b=NA)[!is.na(x$a),]
str(x)

produces the desired result.

'data.frame':   0 obs. of  2 variables:
 $ a: logi 
 $ b: logi 

But it looks clumsy. Is there a smarter way?

Karsten W.
  • 16,858
  • 11
  • 64
  • 99

0 Answers0