diff --git a/DESCRIPTION b/DESCRIPTION index d47f3d9..1e17b60 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,7 +32,7 @@ Imports: stats (>= 3.3.0), stringr (>= 1.2.0), tibble (>= 1.4.2), - tidyr (>= 0.6.1), + tidyr (>= 1.0.0), utils (>= 3.3.0) License: MIT + file LICENSE Encoding: UTF-8 diff --git a/NAMESPACE b/NAMESPACE index e085c55..fe55c7f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -73,6 +73,7 @@ importFrom(stringr,str_match) importFrom(stringr,str_split) importFrom(tibble,as_tibble) importFrom(tidyr,nest) +importFrom(tidyr,one_of) importFrom(utils,View) importFrom(utils,bibentry) importFrom(utils,browseURL) diff --git a/R/browse.R b/R/browse.R index 0286783..0b44b66 100644 --- a/R/browse.R +++ b/R/browse.R @@ -231,7 +231,7 @@ vars_spell <- function(select_columns, columns_full_tab, possibleargs){ # expand table (to nest/unnest taxonomic info) #' @importFrom dplyr group_by %>% -#' @importFrom tidyr nest +#' @importFrom tidyr nest one_of #' @noRd taxa_nest <- function(x, full_tbl){ @@ -261,8 +261,8 @@ taxa_nest <- function(x, full_tbl){ nested_var <- taxas[which(taxas %in% names(x))] out <- x %>% - dplyr::group_by(.dots = setdiff(names(x), taxas)) %>% - tidyr::nest(key_col = nested_var, nest_cols = nested_var) + dplyr::group_by(.dots = setdiff(names(x), taxas)) %>% + tidyr::nest(taxas = tidyr::one_of(taxas)) # Names of taxonomic lists names(out)[2] <- nested_var } @@ -274,12 +274,12 @@ taxa_nest <- function(x, full_tbl){ # nest data set out <- x %>% dplyr::group_by(.dots = setdiff(names(x),taxas)) %>% - tidyr::nest(.key = taxas) + tidyr::nest(taxas = tidyr::one_of(taxas)) # Names of taxonomic lists - names(out$taxas) <- paste0("taxa_project_#_", out$proj_metadata_key) + names(out$taxas) <- paste0("taxa_project_", out$proj_metadata_key) } - + return(out) }