Skip to content

Commit

Permalink
Apply "84 and #86 to vpath year level2
Browse files Browse the repository at this point in the history
  • Loading branch information
damianooldoni committed Jul 1, 2022
1 parent 8428997 commit 15de9be
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 205 deletions.
5 changes: 0 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ importFrom(dplyr,filter)
importFrom(dplyr,filter_at)
importFrom(dplyr,full_join)
importFrom(dplyr,group_by)
importFrom(dplyr,if_else)
importFrom(dplyr,inner_join)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
Expand All @@ -61,10 +60,8 @@ importFrom(dplyr,tally)
importFrom(dplyr,tibble)
importFrom(dplyr,ungroup)
importFrom(dplyr,vars)
importFrom(egg,ggarrange)
importFrom(ggplot2,aes)
importFrom(ggplot2,element_text)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,geom_bar)
importFrom(ggplot2,geom_line)
importFrom(ggplot2,geom_point)
Expand All @@ -77,7 +74,6 @@ importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,theme)
importFrom(ggplot2,xlab)
importFrom(ggplot2,ylab)
importFrom(ggplot2,ylim)
importFrom(grDevices,grey)
importFrom(graphics,legend)
importFrom(gratia,derivatives)
Expand Down Expand Up @@ -143,7 +139,6 @@ importFrom(stringr,str_to_lower)
importFrom(svDialogs,dlgInput)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(tidyselect,all_of)
importFrom(tidyselect,ends_with)
importFrom(tidyselect,one_of)
importFrom(tidyselect,vars_pull)
Expand Down
1 change: 1 addition & 0 deletions R/visualize_pathways_level1.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ visualize_pathways_level1 <- function(df,
"."
)
)
assertthat::assert_that(length(category) == 1)
assertthat::assert_that(category %in% categories,
msg = paste0(
"`category` is not correct. Choose one of: ",
Expand Down
9 changes: 3 additions & 6 deletions R/visualize_pathways_level2.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,18 @@ visualize_pathways_level2 <- function(df,
assertable::assert_colnames(df, pathway_level2_names, only_colnames = FALSE)
# Check category
if (!is.null(category)) {
valid_categories <- c("Chordata", "Not Chordata", "Plantae", "Animalia",
"Fungi", "Chromista", "Archaea", "Bacteria",
"Protozoa", "Viruses", "incertae sedis")
assertthat::assert_that(is.character(category),
msg = paste0(
"`category` must be NULL or a character. One of: ",
paste(valid_categories, collapse = ", "),
paste(categories, collapse = ", "),
"."
)
)
assertthat::assert_that(length(category) == 1)
assertthat::assert_that(category %in% valid_categories,
assertthat::assert_that(category %in% categories,
msg = paste0(
"`category` is not correct. Choose one of: ",
paste0(valid_categories, collapse = ", "),
paste0(categories, collapse = ", "),
"."
)
)
Expand Down
2 changes: 1 addition & 1 deletion R/visualize_pathways_year_level1.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#' @param x_lab `NULL` or character. x-axis label. Default: `"Number of
#' introduced taxa"`.
#' @param y_lab `NULL` or character. Title of the graph. Default: `"Pathways"`.
#' #' @return A list with three slots:
#' @return A list with three slots:
#' - `plot`: ggplot2 object (or egg object if facets are used). `NULL` if there
#' are no data to plot.
#' - `data_top_graph`: data.frame (tibble) with data used for the main plot (top
Expand Down
Loading

0 comments on commit 15de9be

Please sign in to comment.