I'm trying to make a pivot table with pivottabler
package. I want to convert the pivot table object to dataframe, so that I can convert it to data table (with DT) and render it in Shiny app, so that it's downloadable.
library(pivottabler)
pt = qpvt(mtcars, 'cyl', 'vs', 'n()')
I tried to convert it to matrix
as.data.frame(pt)
I got error message like below:
Error in as.data.frame.default(pt) : cannot coerce class ‘c("PivotTable", "R6")’ to a data.frame
Does anyone know how to convert the pivot table object to dataframe?