toJSONstat | R Documentation |
This function takes a data frame or list of data frames and returns
a string representation in JSON-stat format. The input data frame(s)
must be in maximally long tidy format: with only one value
column and all other columns representing dimensions.
toJSONstat(x, value = "value", ...)
x |
a data frame or list of data frames |
value |
name of value column |
... |
arguments passed on to |
For a data frame: A JSON-stat format response with class
dataset
. For a list of data frames: A JSON-stat format response with
class collection
.
library(reshape)
irises <- melt(cbind(iris, Specimen=rep(1:50, 3)),
id.vars=c("Species", "Specimen"))
irisJSONstat <- toJSONstat(list(iris=irises))
cat(substr(irisJSONstat, 1, 76))
# Add indentation whitespace
toJSONstat(as.data.frame(Titanic), value = "Freq", pretty = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.