From 675011ad17acd47534a8368ad799cb126a9efd5b Mon Sep 17 00:00:00 2001 From: stemangiola Date: Tue, 9 Jun 2020 10:12:14 +1000 Subject: [PATCH] fix example because too long for CRAN --- R/methods.R | 8 ++++++-- man/lower_triangular-methods.Rd | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/R/methods.R b/R/methods.R index 9d3b0a5..31c930b 100644 --- a/R/methods.R +++ b/R/methods.R @@ -1311,11 +1311,15 @@ setMethod("keep_variable", "tbl_df", .keep_variable) #' library(purrr) #' library(tidyr) #' -#' mtcars_tidy_permuted = permute_nest(mtcars_tidy, car_model, c(feature,value)) +#' mtcars_tidy_permuted = +#' mtcars_tidy %>% +#' filter(feature == "mpg") %>% +#' head(5) %>% +#' permute_nest(car_model, c(feature,value)) #' #' mtcars_tidy_permuted %>% #' # Summarise mpg -#' mutate(data = map(data, ~ .x %>% filter(feature == "mpg") %>% summarise(mean(value)))) %>% +#' mutate(data = map(data, ~ .x %>% summarise(mean(value)))) %>% #' unnest(data) %>% #' #' # Lower triangular diff --git a/man/lower_triangular-methods.Rd b/man/lower_triangular-methods.Rd index 2b3ab18..20a0966 100644 --- a/man/lower_triangular-methods.Rd +++ b/man/lower_triangular-methods.Rd @@ -43,11 +43,15 @@ library(dplyr) library(purrr) library(tidyr) -mtcars_tidy_permuted = permute_nest(mtcars_tidy, car_model, c(feature,value)) +mtcars_tidy_permuted = + mtcars_tidy \%>\% + filter(feature == "mpg") \%>\% + head(5) \%>\% + permute_nest(car_model, c(feature,value)) mtcars_tidy_permuted \%>\% # Summarise mpg - mutate(data = map(data, ~ .x \%>\% filter(feature == "mpg") \%>\% summarise(mean(value)))) \%>\% + mutate(data = map(data, ~ .x \%>\% summarise(mean(value)))) \%>\% unnest(data) \%>\% # Lower triangular