Skip to content

Commit

Permalink
drop list columns
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Mar 4, 2019
1 parent 364576c commit eafd7c5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
@@ -1,7 +1,7 @@
Package: esquisse Package: esquisse
Type: Package Type: Package
Title: Explore and Visualize Your Data Interactively Title: Explore and Visualize Your Data Interactively
Version: 0.1.7.940 Version: 0.1.7.950
Authors@R: c(person("Fanny", "Meyer", email = "fanny.meyer@dreamrs.fr", role = c("aut")), Authors@R: c(person("Fanny", "Meyer", email = "fanny.meyer@dreamrs.fr", role = c("aut")),
person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")), person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")),
person("Ian", "Carroll", comment = "Facets support", role = "ctb")) person("Ian", "Carroll", comment = "Facets support", role = "ctb"))
Expand Down
3 changes: 3 additions & 0 deletions R/esquisser.R
Expand Up @@ -35,6 +35,9 @@ esquisser <- function(data = NULL,
options("esquisse.coerceVars" = coerceVars) options("esquisse.coerceVars" = coerceVars)


res_data <- get_data(data, name = deparse(substitute(data))) res_data <- get_data(data, name = deparse(substitute(data)))
if (!is.null(res_data$esquisse_data)) {
res_data$esquisse_data <- dropListColumns(res_data$esquisse_data)
}
rv <- reactiveValues( rv <- reactiveValues(
data = res_data$esquisse_data, data = res_data$esquisse_data,
name = res_data$esquisse_data_name name = res_data$esquisse_data_name
Expand Down
4 changes: 2 additions & 2 deletions R/esquisserServer.R
Expand Up @@ -124,7 +124,7 @@ esquisserServer <- function(input, output, session, data = NULL, dataModule = c(
# print(paste("EXECUTED", i)) # print(paste("EXECUTED", i))


data <- dataChart$data data <- dataChart$data
if (!is.null(paramsChart$index) && is.logical(paramsChart$index)) { if (!is.null(paramsChart$index) && is.logical(paramsChart$index) & length(paramsChart$index) > 0) {
data <- data[paramsChart$index, , drop = FALSE] data <- data[paramsChart$index, , drop = FALSE]
} }


Expand Down Expand Up @@ -209,7 +209,7 @@ esquisserServer <- function(input, output, session, data = NULL, dataModule = c(
}, ignoreInit = TRUE) }, ignoreInit = TRUE)
observeEvent(list(dataChart$data, paramsChart$index), { observeEvent(list(dataChart$data, paramsChart$index), {
data <- dataChart$data data <- dataChart$data
if (!is.null(paramsChart$index) && is.logical(paramsChart$index)) { if (!is.null(paramsChart$index) && is.logical(paramsChart$index) & length(paramsChart$index) > 0) {
data <- data[paramsChart$index, , drop = FALSE] data <- data[paramsChart$index, , drop = FALSE]
} }
output_module$data <- data output_module$data <- data
Expand Down
3 changes: 3 additions & 0 deletions R/get_data.R
Expand Up @@ -42,6 +42,9 @@ get_data <- function(data = NULL, name = NULL) {
} }


# esquisse_data_name <- gsub("\\[.*", "", esquisse_data_name) # esquisse_data_name <- gsub("\\[.*", "", esquisse_data_name)
} else {
esquisse_data <- NULL
esquisse_data_name <- ""
} }
} else { } else {
if (rstudioapi::isAvailable()) { if (rstudioapi::isAvailable()) {
Expand Down
5 changes: 4 additions & 1 deletion R/utils.R
Expand Up @@ -281,5 +281,8 @@ capitalize <- function(x) {
} }





dropListColumns <- function(x) {
type_col <- vapply(X = x, FUN = typeof, FUN.VALUE = character(1), USE.NAMES = FALSE)
x[, type_col != "list", drop = FALSE]
}


0 comments on commit eafd7c5

Please sign in to comment.