R cmd check
This commit is contained in:
Родитель
4b8a15048e
Коммит
947ad015e4
|
@ -1,7 +1,7 @@
|
||||||
Package: datamations
|
Package: datamations
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: Animated Explanations of Data Analysis Pipelines
|
Title: Animated Explanations of Data Analysis Pipelines
|
||||||
Version: 0.0.0.9008
|
Version: 0.0.0.9009
|
||||||
Authors@R: c(
|
Authors@R: c(
|
||||||
person("Xiaoying", "Pu", email = "xpu@umich.edu", role = c("aut")),
|
person("Xiaoying", "Pu", email = "xpu@umich.edu", role = c("aut")),
|
||||||
person("Sean", "Kross", email = "smk240@gmail.com", role = c("aut")),
|
person("Sean", "Kross", email = "smk240@gmail.com", role = c("aut")),
|
||||||
|
@ -35,13 +35,11 @@ Imports:
|
||||||
shinyWidgets,
|
shinyWidgets,
|
||||||
shinydashboard,
|
shinydashboard,
|
||||||
shinyAce,
|
shinyAce,
|
||||||
|
jsonlite,
|
||||||
|
palmerpenguins,
|
||||||
golem,
|
golem,
|
||||||
styler,
|
styler,
|
||||||
shinyjs
|
shinyjs
|
||||||
Suggests:
|
Suggests:
|
||||||
jsonlite,
|
|
||||||
palmerpenguins,
|
|
||||||
testthat (>= 2.1.0)
|
testthat (>= 2.1.0)
|
||||||
Depends:
|
|
||||||
R (>= 3.5.0)
|
|
||||||
Config/testthat/edition: 3
|
Config/testthat/edition: 3
|
||||||
|
|
|
@ -211,7 +211,7 @@ prep_specs_summarize <- function(.data, mapping, toJSON = TRUE, pretty = TRUE, h
|
||||||
sign = ifelse(.x == "Upper", "+", "-")
|
sign = ifelse(.x == "Upper", "+", "-")
|
||||||
)))
|
)))
|
||||||
tooltip_encoding_first <- list(spec_encoding$tooltip[[1]])
|
tooltip_encoding_first <- list(spec_encoding$tooltip[[1]])
|
||||||
tooltip_encoding_rest <- list(spec_encoding$tooltip[[-1]])
|
tooltip_encoding_rest <- list(spec_encoding$tooltip[-1])
|
||||||
|
|
||||||
errorbar_tooltip <- append(tooltip_encoding_first, errorbar_tooltip)
|
errorbar_tooltip <- append(tooltip_encoding_first, errorbar_tooltip)
|
||||||
errorbar_tooltip <- append(errorbar_tooltip, tooltip_encoding_rest)
|
errorbar_tooltip <- append(errorbar_tooltip, tooltip_encoding_rest)
|
||||||
|
|
|
@ -30,9 +30,9 @@ expect_data_values <- function(single_spec, df) {
|
||||||
dplyr::mutate_if(is.factor, as.character) %>%
|
dplyr::mutate_if(is.factor, as.character) %>%
|
||||||
dplyr::mutate_if(is.character, dplyr::coalesce, "NA")
|
dplyr::mutate_if(is.character, dplyr::coalesce, "NA")
|
||||||
|
|
||||||
if ("y" %in% names(df)) {
|
if (Y_FIELD_CHR %in% names(df)) {
|
||||||
df <- df %>%
|
df <- df %>%
|
||||||
dplyr::filter(!is.na(y))
|
dplyr::filter(!is.na(!!Y_FIELD))
|
||||||
}
|
}
|
||||||
|
|
||||||
spec_data <- single_spec %>%
|
spec_data <- single_spec %>%
|
||||||
|
|
|
@ -12,15 +12,18 @@ test_that("prep_specs_summarize returns a list with four elements - one for the
|
||||||
expect_meta_axes(specs, TRUE) # Axes are set to TRUE to be shown
|
expect_meta_axes(specs, TRUE) # Axes are set to TRUE to be shown
|
||||||
expect_data_values(specs[[1]], palmerpenguins::penguins %>%
|
expect_data_values(specs[[1]], palmerpenguins::penguins %>%
|
||||||
dplyr::arrange(species) %>%
|
dplyr::arrange(species) %>%
|
||||||
dplyr::mutate(x = 1, gemini_id = dplyr::row_number()) %>%
|
dplyr::mutate(!!X_FIELD := 1, gemini_id = dplyr::row_number()) %>%
|
||||||
dplyr::select(gemini_id, species, x, y = bill_length_mm)) # One data value for each row in the input data frame, containing grouping variables - x value depending on the grouping - x = 1 if n_groups != 3
|
dplyr::select(gemini_id, species, !!X_FIELD, !!Y_FIELD := bill_length_mm, !!Y_TOOLTIP_FIELD := bill_length_mm)) # One data value for each row in the input data frame, containing grouping variables - x value depending on the grouping - x = 1 if n_groups != 3
|
||||||
expect_data_values(specs[[2]], palmerpenguins::penguins %>%
|
expect_data_values(specs[[2]], palmerpenguins::penguins %>%
|
||||||
dplyr::arrange(species) %>%
|
dplyr::arrange(species) %>%
|
||||||
dplyr::mutate(x = 1, gemini_id = dplyr::row_number()) %>%
|
dplyr::mutate(!!X_FIELD := 1, gemini_id = dplyr::row_number()) %>%
|
||||||
dplyr::filter(!is.na(bill_length_mm)) %>%
|
dplyr::filter(!is.na(bill_length_mm)) %>%
|
||||||
dplyr::group_by(species) %>%
|
dplyr::group_by(species) %>%
|
||||||
dplyr::mutate(y = mean(bill_length_mm, na.rm = TRUE)) %>%
|
dplyr::mutate(
|
||||||
dplyr::select(gemini_id, species, x, y) %>%
|
!!Y_FIELD := mean(bill_length_mm, na.rm = TRUE),
|
||||||
|
!!Y_TOOLTIP_FIELD := !!Y_FIELD
|
||||||
|
) %>%
|
||||||
|
dplyr::select(gemini_id, species, !!X_FIELD, !!Y_FIELD, !!Y_TOOLTIP_FIELD) %>%
|
||||||
dplyr::ungroup()) # Second element, all of the values are the summary value
|
dplyr::ungroup()) # Second element, all of the values are the summary value
|
||||||
expect_spec_contains_mark_encoding(specs[1:2]) # mark and encoding are within `spec` for the first two specs - it works differently for the error bars, since they are layered
|
expect_spec_contains_mark_encoding(specs[1:2]) # mark and encoding are within `spec` for the first two specs - it works differently for the error bars, since they are layered
|
||||||
expect_grouping_order_1(specs[[1]]) # The grouping order is correct
|
expect_grouping_order_1(specs[[1]]) # The grouping order is correct
|
||||||
|
@ -41,20 +44,23 @@ test_that("prep_specs_summarize returns a list with four elements - one for the
|
||||||
dplyr::arrange(species, island, sex) %>%
|
dplyr::arrange(species, island, sex) %>%
|
||||||
dplyr::mutate(
|
dplyr::mutate(
|
||||||
gemini_id = dplyr::row_number(),
|
gemini_id = dplyr::row_number(),
|
||||||
x = 1,
|
!!X_FIELD := 1,
|
||||||
) %>%
|
) %>%
|
||||||
dplyr::filter(!is.na(bill_length_mm)) %>%
|
dplyr::filter(!is.na(bill_length_mm)) %>%
|
||||||
dplyr::select(gemini_id, species, island, sex, x, y = bill_length_mm)) # One data value for each row in the input data frame, containing grouping variables - x value depending on the grouping - x = 1 if n_groups != 3
|
dplyr::select(gemini_id, species, island, sex, !!X_FIELD, !!Y_FIELD := bill_length_mm, !!Y_TOOLTIP_FIELD := bill_length_mm)) # One data value for each row in the input data frame, containing grouping variables - x value depending on the grouping - x = 1 if n_groups != 3
|
||||||
expect_data_values(specs[[2]], palmerpenguins::penguins %>%
|
expect_data_values(specs[[2]], palmerpenguins::penguins %>%
|
||||||
dplyr::arrange(species, island, sex) %>%
|
dplyr::arrange(species, island, sex) %>%
|
||||||
dplyr::mutate(
|
dplyr::mutate(
|
||||||
gemini_id = dplyr::row_number(),
|
gemini_id = dplyr::row_number(),
|
||||||
x = 1
|
!!X_FIELD := 1
|
||||||
) %>%
|
) %>%
|
||||||
dplyr::filter(!is.na(bill_length_mm)) %>%
|
dplyr::filter(!is.na(bill_length_mm)) %>%
|
||||||
dplyr::group_by(species, island, sex) %>%
|
dplyr::group_by(species, island, sex) %>%
|
||||||
dplyr::mutate(y = mean(bill_length_mm, na.rm = TRUE)) %>%
|
dplyr::mutate(
|
||||||
dplyr::select(gemini_id, species, island, sex, x, y) %>%
|
!!Y_FIELD := mean(bill_length_mm, na.rm = TRUE),
|
||||||
|
!!Y_TOOLTIP_FIELD := !!Y_FIELD
|
||||||
|
) %>%
|
||||||
|
dplyr::select(gemini_id, species, island, sex, !!X_FIELD, !!Y_FIELD, !!Y_TOOLTIP_FIELD) %>%
|
||||||
dplyr::ungroup()) # Second element, all of the values are the summary value
|
dplyr::ungroup()) # Second element, all of the values are the summary value
|
||||||
expect_spec_contains_mark_encoding(specs[1:2]) # mark and encoding are within `spec`
|
expect_spec_contains_mark_encoding(specs[1:2]) # mark and encoding are within `spec`
|
||||||
expect_grouping_order_3(specs[[1]]) # The grouping order is correct
|
expect_grouping_order_3(specs[[1]]) # The grouping order is correct
|
||||||
|
@ -73,13 +79,16 @@ test_that("prep_specs_summarize returns a list with four elements - one for the
|
||||||
expect_meta_parse_value(specs[2], NULL) # Second element meta is empty
|
expect_meta_parse_value(specs[2], NULL) # Second element meta is empty
|
||||||
expect_meta_axes(specs, FALSE) # Additional axes are NOT shown when there's no groups
|
expect_meta_axes(specs, FALSE) # Additional axes are NOT shown when there's no groups
|
||||||
expect_data_values(specs[[1]], palmerpenguins::penguins %>%
|
expect_data_values(specs[[1]], palmerpenguins::penguins %>%
|
||||||
dplyr::mutate(x = 1, gemini_id = dplyr::row_number()) %>%
|
dplyr::mutate(!!X_FIELD := 1, gemini_id = dplyr::row_number()) %>%
|
||||||
dplyr::select(gemini_id, x, y = bill_length_mm)) # One data value for each row in the input data frame, containing grouping variables - x value depending on the grouping - x = 1 if n_groups != 3
|
dplyr::select(gemini_id, !!X_FIELD, !!Y_FIELD := bill_length_mm, !!Y_TOOLTIP_FIELD := bill_length_mm)) # One data value for each row in the input data frame, containing grouping variables - x value depending on the grouping - x = 1 if n_groups != 3
|
||||||
expect_data_values(specs[[2]], palmerpenguins::penguins %>%
|
expect_data_values(specs[[2]], palmerpenguins::penguins %>%
|
||||||
dplyr::mutate(x = 1, gemini_id = dplyr::row_number()) %>%
|
dplyr::mutate(!!X_FIELD := 1, gemini_id = dplyr::row_number()) %>%
|
||||||
dplyr::filter(!is.na(bill_length_mm)) %>%
|
dplyr::filter(!is.na(bill_length_mm)) %>%
|
||||||
dplyr::mutate(y = mean(bill_length_mm, na.rm = TRUE)) %>%
|
dplyr::mutate(
|
||||||
dplyr::select(gemini_id, x, y))
|
!!Y_FIELD := mean(bill_length_mm, na.rm = TRUE),
|
||||||
|
!!Y_TOOLTIP_FIELD := !!Y_FIELD
|
||||||
|
) %>%
|
||||||
|
dplyr::select(gemini_id, !!X_FIELD, !!Y_FIELD, !!Y_TOOLTIP_FIELD))
|
||||||
expect_mark_encoding_top_level(specs[1:2]) # mark and encoding are at the top level
|
expect_mark_encoding_top_level(specs[1:2]) # mark and encoding are at the top level
|
||||||
expect_no_grouping(specs) # There is no grouping
|
expect_no_grouping(specs) # There is no grouping
|
||||||
})
|
})
|
||||||
|
|
Загрузка…
Ссылка в новой задаче