Description Usage Arguments Value Examples
Convert a data.frame
to a list of lists for compatibility with dashDataTable
. The function will return a nested list object in which the sublists contain named elements of varying type; the names correspond to the column names in the original data.frame
.
1 |
df |
A |
a list
object, in which the sublists are named elements of varying type; the names correspond to the column names in the data.frame
specified by df
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # first, create data frame
df <- read.csv(url(
'https://raw.githubusercontent.com/plotly/datasets/master/solar.csv'
),
check.names=FALSE,
stringsAsFactors=FALSE
)
# then convert to list-of-lists format for use in dashTable
# the following snippet below will print as JSON
# see the help for dashDataTable to see an actual app example
dashDataTable(
id = 'table',
columns = lapply(colnames(df), function(x) {
list(name = x, id = x)
}),
data = df_to_list(df)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.