This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 73
Update dashTable to 4.5.1 with support for async loading in R #668
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# AUTO GENERATED FILE - DO NOT EDIT | ||
|
||
export(dashDataTable) | ||
export(df_to_list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
df_to_list <- function(df) { | ||
if(!(is.data.frame(df))) | ||
stop("df_to_list requires a data.frame object; please verify that df is of the correct type.") | ||
setNames(lapply(split(df, seq(nrow(df))), | ||
FUN = function (x) { | ||
as.list(x) | ||
}), NULL) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
% Auto-generated: do not edit by hand | ||
\name{df_to_list} | ||
|
||
\alias{df_to_list} | ||
|
||
\title{Convert data.frame objects to list-of-lists format} | ||
|
||
\description{ | ||
Convert a \code{\link{data.frame}} to a list of lists for compatibility with \code{\link{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 \code{\link{data.frame}}. | ||
} | ||
|
||
\usage{ | ||
df_to_list(df=NULL) | ||
} | ||
|
||
\arguments{ | ||
\item{df}{A \code{data.frame} object, which will be transformed into a list of lists. Each row will become a single named list, in which the elements are named as the columns from which they were extracted.} | ||
} | ||
|
||
\examples{ | ||
\dontrun{ | ||
# 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 this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Marc-Andre-Rivet This function was also user-authored (by me), to emulate the syntax on the Python side using
df_to_dict
. R users reported that it made usingdashDataTable
easier for them, so it's persisted. It turns out that it's useful fordashBio
as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one is OK to leave in
master
, along with the rest of the R package items (vignettes, Rd files, etc).