From 70adfbac9cf2c2cd55b9c9030d2f7578b182e37a Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 13:59:47 +1100 Subject: [PATCH 01/10] Changed class name and generic name --- NAMESPACE | 2 +- R/extract_data.R | 2 +- R/load_austraits.R | 2 +- R/print.austraits.R | 7 ++++--- man/{print.austraits.Rd => print.traits.build.Rd} | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) rename man/{print.austraits.Rd => print.traits.build.Rd} (79%) diff --git a/NAMESPACE b/NAMESPACE index cf686d9..8653e64 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,6 @@ # Generated by roxygen2: do not edit by hand -S3method(print,austraits) +S3method(print,traits.build) export("%>%") export(as_wide_table) export(bind_databases) diff --git a/R/extract_data.R b/R/extract_data.R index e202310..f276932 100644 --- a/R/extract_data.R +++ b/R/extract_data.R @@ -232,7 +232,7 @@ extract_data <- function(database, table = NA, col, col_value) { "taxa","contributors","sources","definitions","schema", "metadata","build_info")] # Assign class - attr(ret, "class") <- "austraits" + attr(data, "class") <- "traits.build" } diff --git a/R/load_austraits.R b/R/load_austraits.R index 020fd06..2f332a3 100644 --- a/R/load_austraits.R +++ b/R/load_austraits.R @@ -82,7 +82,7 @@ load_austraits <- function(doi = NULL, version = NULL, path = "data/austraits", data <- readRDS(file_nm) # Assign class - attr(data, "class") <- "austraits" + attr(data, "class") <- "traits.build" data } diff --git a/R/print.austraits.R b/R/print.austraits.R index 58f14a2..eb15730 100644 --- a/R/print.austraits.R +++ b/R/print.austraits.R @@ -1,13 +1,14 @@ #' @title Generic for outputting a nice summary for austraits objects #' -#' @name print.austraits +#' @name print.traits.build #' @param database traits.build database #' @param \dots passed to print #' #' @return nicely printed table #' @export -print.austraits <- function(database, ...){ +print.traits.build <- function(database, ...){ + browser() # Setting up version <- database$build_info$version %>% as.character() @@ -18,7 +19,7 @@ print.austraits <- function(database, ...){ cat("This is version", version, "of austraits!\n", - "\nThis object contains a total of", + "\nThis database contains a total of", nrecords, "records", "for", nspecies, "taxa and", ntraits, "traits.\n") diff --git a/man/print.austraits.Rd b/man/print.traits.build.Rd similarity index 79% rename from man/print.austraits.Rd rename to man/print.traits.build.Rd index 37d4cf4..01904d4 100644 --- a/man/print.austraits.Rd +++ b/man/print.traits.build.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/print.austraits.R -\name{print.austraits} -\alias{print.austraits} +\name{print.traits.build} +\alias{print.traits.build} \title{Generic for outputting a nice summary for austraits objects} \usage{ -\method{print}{austraits}(database, ...) +\method{print}{traits.build}(database, ...) } \arguments{ \item{database}{traits.build database} From 8ce6ca98dd88a5783a039e2e859ae9444ee659b0 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 14:27:30 +1100 Subject: [PATCH 02/10] Replacing cat with cli --- R/print.austraits.R | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/R/print.austraits.R b/R/print.austraits.R index eb15730..58fef9f 100644 --- a/R/print.austraits.R +++ b/R/print.austraits.R @@ -8,7 +8,7 @@ #' @export print.traits.build <- function(database, ...){ - browser() + # browser() # Setting up version <- database$build_info$version %>% as.character() @@ -16,13 +16,21 @@ print.traits.build <- function(database, ...){ nspecies <- unique(database$traits$taxon_name) %>% length() ntraits <- unique(database$traits$trait_name) %>% length() - cat("This is version", - version, - "of austraits!\n", - "\nThis database contains a total of", - nrecords, "records", - "for", nspecies, "taxa and", - ntraits, "traits.\n") + database_name <- database$metadata$title + + traits.build_version <- at_six$metadata$related_identifiers |> + convert_list_to_df2() |> + dplyr::filter(resource_type == "software") |> + dplyr::pull(version) + + # Formulate message + cli::cli_h1("This is {database_name}!") + + cli::cli_bullets(c( + "i" = "A database built using traits.build version {traits.build_version}", + "i" = "This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits." + ) + ) if(package_version(version) <= '3.0.2'){ @@ -43,7 +51,6 @@ print.traits.build <- function(database, ...){ ) } - cat("\n\nTo access a component, try using the $ e.g. austraits$traits") } From 047dbb14ddd89c2b592b3dd306194dfb1b21a3a2 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 14:54:07 +1100 Subject: [PATCH 03/10] Using cli altogether --- R/print.austraits.R | 97 +++++++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/R/print.austraits.R b/R/print.austraits.R index 58fef9f..62de1c0 100644 --- a/R/print.austraits.R +++ b/R/print.austraits.R @@ -8,14 +8,8 @@ #' @export print.traits.build <- function(database, ...){ - # browser() # Setting up - version <- database$build_info$version %>% as.character() - nrecords <- nrow(database$traits) - nspecies <- unique(database$traits$taxon_name) %>% length() - ntraits <- unique(database$traits$trait_name) %>% length() - database_name <- database$metadata$title traits.build_version <- at_six$metadata$related_identifiers |> @@ -23,35 +17,78 @@ print.traits.build <- function(database, ...){ dplyr::filter(resource_type == "software") |> dplyr::pull(version) - # Formulate message - cli::cli_h1("This is {database_name}!") - - cli::cli_bullets(c( - "i" = "A database built using traits.build version {traits.build_version}", - "i" = "This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits." - ) - ) + version <- database$build_info$version %>% as.character() + nrecords <- nrow(database$traits) + nspecies <- unique(database$traits$taxon_name) %>% length() + ntraits <- unique(database$traits$trait_name) %>% length() + if(package_version(version) <= '3.0.2'){ + + # Setting up + database_name <- database$definitions$austraits$description - cat("\nThis object is a 'list' with the following components:\n\n", - database$definitions$austraits$elements %>% - purrr::map(~.x[["description"]]) %>% - as.vector() %>% - sprintf("- `%s`: %s", names(.), .) %>% - paste(collapse="\n") - ) + fun <- function() { + cli::cli_h1("This is {version} of {database_name}!") + + cli::cli_bullets(c( + "i" = "A database built using traits.build version {traits.build_version}", + "i" = "This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits." + ) + ) + + cli::cli_h2("This object is a 'list' with the following components:") + cli::cli_div(theme = list(span.emph = list(color = "forestgreen"))) + cli::cli_ul() + cli::cli_li("{.emph traits}: A table containing measurements of traits.") + cli::cli_li("{.emph locations}: A table containing observations of location/site characteristics associated with information in `traits`. Cross referencing between the two dataframes is possible using combinations of the variables `dataset_id`, `location_name`.") + cli::cli_li("{.emph contexts}: A table containing observations of contextual characteristics associated with information in `traits`. Cross referencing between the two dataframes is possible using combinations of the variables `dataset_id`, `link_id`, and `link_vals`.") + cli::cli_li("{.emph methods}: A table containing details on methods with which data were collected, including time frame and source. Cross referencing with the `traits` table is possible using combinations of the variables `dataset_id`, `trait_name`.") + cli::cli_li("{.emph excluded_data}: A table of data that did not pass quality test and so were excluded from the master dataset.") + cli::cli_li("{.emph taxonomic_updates}: A table of all taxonomic changes implemented in the construction of AusTraits. Changes are determined by comapring against the APC (Australian Plant Census) and APNI (Australian Plant Names Index).") + cli::cli_li("{.emph taxa}: A table containing details on taxa associated with information in `traits`. This information has been sourced from the APC (Australian Plant Census) and APNI (Australian Plant Names Index) and is released under a CC-BY3 license.") + cli::cli_li("{.emph contributors}: A table of people contributing to each study.") + cli::cli_li("{.emph sources}: Bibtex entries for all primary and secondary sources in the compilation.") + cli::cli_li("{.emph definitions}: A copy of the definitions for all tables and terms. Information included here was used to process data and generate any documentation for the study.") + cli::cli_li("{.emph build_info}: A description of the computing environment used to create this version of the dataset, including version number, git commit and R session_info.") + cli::cli_end() + + cli::cli_alert_info("To access a component, try using the $ e.g. austraits$traits") + } + + fun() } else{ - cat("\nThis object is a 'list' with the following components:\n\n", - database$schema$austraits$elements %>% - purrr::map(~.x[["description"]]) %>% - as.vector() %>% - sprintf("- `%s`: %s", names(.), .) %>% - paste(collapse="\n") - ) + fun <- function() { + cli::cli_h1("This is {version} of {database_name}!") + + cli::cli_bullets(c( + "i" = "A database built using traits.build version {traits.build_version}", + "i" = "This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits." + ) + ) + + cli::cli_h2("This object is a 'list' with the following components:") + cli::cli_div(theme = list(span.emph = list(color = "forestgreen"))) + cli::cli_ul() + cli::cli_li("{.emph traits}: A table containing measurements of traits.") + cli::cli_li("{.emph locations}: A table containing observations of location/site characteristics associated with information in `traits`. Cross referencing between the two dataframes is possible using combinations of the variables `dataset_id`, `location_name`.") + cli::cli_li("{.emph contexts}: A table containing observations of contextual characteristics associated with information in `traits`. Cross referencing between the two dataframes is possible using combinations of the variables `dataset_id`, `link_id`, and `link_vals`.") + cli::cli_li("{.emph methods}: A table containing details on methods with which data were collected, including time frame and source. Cross referencing with the `traits` table is possible using combinations of the variables `dataset_id`, `trait_name`.") + cli::cli_li("{.emph excluded_data}: A table of data that did not pass quality test and so were excluded from the master dataset.") + cli::cli_li("{.emph taxa}: A table containing details on taxa associated with information in `traits`. This information has been sourced from the APC (Australian Plant Census) and APNI (Australian Plant Names Index) and is released under a CC-BY3 license.") + cli::cli_li("{.emph definitions}: A copy of the definitions for all tables and terms. Information included here was used to process data and generate any documentation for the study.") + cli::cli_li("{.emph sources}: Bibtex entries for all primary and secondary sources in the compilation.") + cli::cli_li("{.emph contributors}: A table of people contributing to each study.") + cli::cli_li("{.emph taxonomic_updates}: table of all taxonomic changes implemented in the construction of AusTraits. Changes are determined by comapring against the APC (Australian Plant Census) and APNI (Australian Plant Names Index).") + cli::cli_li("{.emph metadata}: Metadata associated with the dataset, including title, creators, license, subject, funding sources.") + cli::cli_li("{.emph build_info}: A description of the computing environment used to create this version of the dataset, including version number, git commit and R session_info.") + cli::cli_end() + + cli::cli_alert_info("To access a component, try using the $ e.g. austraits$traits") + } + + fun() } - - cat("\n\nTo access a component, try using the $ e.g. austraits$traits") } From 8da52aae799f6592f5b2dacfb152079002e425eb Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:00:00 +1100 Subject: [PATCH 04/10] Updated formating in cli --- R/print.austraits.R | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/R/print.austraits.R b/R/print.austraits.R index 62de1c0..3becb4b 100644 --- a/R/print.austraits.R +++ b/R/print.austraits.R @@ -47,9 +47,9 @@ print.traits.build <- function(database, ...){ cli::cli_li("{.emph excluded_data}: A table of data that did not pass quality test and so were excluded from the master dataset.") cli::cli_li("{.emph taxonomic_updates}: A table of all taxonomic changes implemented in the construction of AusTraits. Changes are determined by comapring against the APC (Australian Plant Census) and APNI (Australian Plant Names Index).") cli::cli_li("{.emph taxa}: A table containing details on taxa associated with information in `traits`. This information has been sourced from the APC (Australian Plant Census) and APNI (Australian Plant Names Index) and is released under a CC-BY3 license.") + cli::cli_li("{.emph definitions}: A copy of the definitions for all tables and terms. Information included here was used to process data and generate any documentation for the study.") cli::cli_li("{.emph contributors}: A table of people contributing to each study.") cli::cli_li("{.emph sources}: Bibtex entries for all primary and secondary sources in the compilation.") - cli::cli_li("{.emph definitions}: A copy of the definitions for all tables and terms. Information included here was used to process data and generate any documentation for the study.") cli::cli_li("{.emph build_info}: A description of the computing environment used to create this version of the dataset, including version number, git commit and R session_info.") cli::cli_end() @@ -74,14 +74,15 @@ print.traits.build <- function(database, ...){ cli::cli_li("{.emph locations}: A table containing observations of location/site characteristics associated with information in `traits`. Cross referencing between the two dataframes is possible using combinations of the variables `dataset_id`, `location_name`.") cli::cli_li("{.emph contexts}: A table containing observations of contextual characteristics associated with information in `traits`. Cross referencing between the two dataframes is possible using combinations of the variables `dataset_id`, `link_id`, and `link_vals`.") cli::cli_li("{.emph methods}: A table containing details on methods with which data were collected, including time frame and source. Cross referencing with the `traits` table is possible using combinations of the variables `dataset_id`, `trait_name`.") - cli::cli_li("{.emph excluded_data}: A table of data that did not pass quality test and so were excluded from the master dataset.") - cli::cli_li("{.emph taxa}: A table containing details on taxa associated with information in `traits`. This information has been sourced from the APC (Australian Plant Census) and APNI (Australian Plant Names Index) and is released under a CC-BY3 license.") - cli::cli_li("{.emph definitions}: A copy of the definitions for all tables and terms. Information included here was used to process data and generate any documentation for the study.") - cli::cli_li("{.emph sources}: Bibtex entries for all primary and secondary sources in the compilation.") - cli::cli_li("{.emph contributors}: A table of people contributing to each study.") - cli::cli_li("{.emph taxonomic_updates}: table of all taxonomic changes implemented in the construction of AusTraits. Changes are determined by comapring against the APC (Australian Plant Census) and APNI (Australian Plant Names Index).") + cli::cli_li("{.emph excluded_data}: A table of data that did not pass quality test and so were excluded from the master dataset.") + cli::cli_li("{.emph taxonomic_updates}: A table of all taxonomic changes implemented in the construction of AusTraits. Changes are determined by comapring against the APC (Australian Plant Census) and APNI (Australian Plant Names Index).") + cli::cli_li("{.emph taxa}: A table containing details on taxa associated with information in `traits`. This information has been sourced from the APC (Australian Plant Census) and APNI (Australian Plant Names Index) and is released under a CC-BY3 license.") + cli::cli_li("{.emph contributors}: A table of people contributing to each study.") + cli::cli_li("{.emph sources}: Bibtex entries for all primary and secondary sources in the compilation.") + cli::cli_li("{.emph definitions}: A copy of the definitions for all tables and terms. Information included here was used to process data and generate any documentation for the study.") + cli::cli_li("{.emph schema}: A copy of the schema for all tables and terms. Information included here was used to process data and generate any documentation for the study.") cli::cli_li("{.emph metadata}: Metadata associated with the dataset, including title, creators, license, subject, funding sources.") - cli::cli_li("{.emph build_info}: A description of the computing environment used to create this version of the dataset, including version number, git commit and R session_info.") + cli::cli_li("{.emph build_info}: A description of the computing environment used to create this version of the dataset, including version number, git commit and R session_info.") cli::cli_end() cli::cli_alert_info("To access a component, try using the $ e.g. austraits$traits") From 6e19f28c4af0b6a5ccd147a77a64b86da15c58a9 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:15:09 +1100 Subject: [PATCH 05/10] Rename summarise_austraits to summarise_database --- NAMESPACE | 2 +- R/summarise_austraits.R | 18 ++++++++--------- ...ise_austraits.Rd => summarise_database.Rd} | 10 +++++----- tests/testthat/test-summarise_austraits.R | 20 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) rename man/{summarise_austraits.Rd => summarise_database.Rd} (71%) diff --git a/NAMESPACE b/NAMESPACE index 8653e64..998dc4a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -30,7 +30,7 @@ export(plot_locations) export(plot_site_locations) export(plot_trait_distribution_beeswarm) export(separate_trait_values) -export(summarise_austraits) +export(summarise_database) export(summarise_trait_means) export(trait_pivot_longer) export(trait_pivot_wider) diff --git a/R/summarise_austraits.R b/R/summarise_austraits.R index 519b50d..85b6da8 100644 --- a/R/summarise_austraits.R +++ b/R/summarise_austraits.R @@ -1,6 +1,6 @@ #' @title Summarise counts for a particular variable of interest #' -#' @name summarise_austraits +#' @name summarise_database #' @param database traits.build database (list object) #' @param var variable you use wish to see summary of (trait_name, genus, family) #' @@ -8,28 +8,28 @@ #' @export #' @examples #' \dontrun{ -#' summarise_austraits(database = austraits, "trait_name") -#' summarise_austraits(database = austraits, "family") +#' summarise_database(database = austraits, "trait_name") +#' summarise_database(database = austraits, "family") #' } -summarise_austraits <- function(database, var){ +summarise_database <- function(database, var){ if(!var %in% c("trait_name", "family", "genus")){ stop(paste0("Print summary for ", var, " has not been implemented! see examples)")) } switch(var, - trait_name = summarise_austraits_traits(database, var), - genus = summarise_austraits_taxa(database, var), - family = summarise_austraits_taxa(database, var) + trait_name = summarise_database_traits(database, var), + genus = summarise_database_taxa(database, var), + family = summarise_database_taxa(database, var) ) } #' @noRd #' @keywords internal -summarise_austraits_traits <-function(database, var) { +summarise_database_traits <-function(database, var) { ret <- database[["traits"]] %>% @@ -60,7 +60,7 @@ summarise_austraits_traits <-function(database, var) { #' @noRd #' @keywords internal -summarise_austraits_taxa <-function(database, var) { +summarise_database_taxa <-function(database, var) { #Join taxonomic info database <- database %>% join_taxa() diff --git a/man/summarise_austraits.Rd b/man/summarise_database.Rd similarity index 71% rename from man/summarise_austraits.Rd rename to man/summarise_database.Rd index 43f1b65..af70696 100644 --- a/man/summarise_austraits.Rd +++ b/man/summarise_database.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/summarise_austraits.R -\name{summarise_austraits} -\alias{summarise_austraits} +\name{summarise_database} +\alias{summarise_database} \title{Summarise counts for a particular variable of interest} \usage{ -summarise_austraits(database, var) +summarise_database(database, var) } \arguments{ \item{database}{traits.build database (list object)} @@ -19,7 +19,7 @@ Summarise counts for a particular variable of interest } \examples{ \dontrun{ -summarise_austraits(database = austraits, "trait_name") -summarise_austraits(database = austraits, "family") +summarise_database(database = austraits, "trait_name") +summarise_database(database = austraits, "family") } } diff --git a/tests/testthat/test-summarise_austraits.R b/tests/testthat/test-summarise_austraits.R index f6e182e..7690604 100644 --- a/tests/testthat/test-summarise_austraits.R +++ b/tests/testthat/test-summarise_austraits.R @@ -4,24 +4,24 @@ not_supported_austraits <- list(austraits_3.0.2_lite, austraits_4.2.0_lite) test_that("Function works", { - expect_visible(austraits_5.0.0_lite %>% summarise_austraits("family")) - expect_visible(austraits_5.0.0_lite %>% summarise_austraits("genus")) - expect_visible(austraits_5.0.0_lite %>% summarise_austraits("trait_name")) + expect_visible(austraits_5.0.0_lite %>% summarise_database("family")) + expect_visible(austraits_5.0.0_lite %>% summarise_database("genus")) + expect_visible(austraits_5.0.0_lite %>% summarise_database("trait_name")) }) test_that("Throws errors", { - expect_error(austraits_5.0.0_lite %>% summarise_austraits("observation_id")) - expect_error(austraits_5.0.0_lite %>% summarise_austraits("trait")) - expect_error(austraits_5.0.0_lite %>% summarise_austraits("unit")) - expect_error(austraits_5.0.0_lite %>% summarise_austraits("source")) + expect_error(austraits_5.0.0_lite %>% summarise_database("observation_id")) + expect_error(austraits_5.0.0_lite %>% summarise_database("trait")) + expect_error(austraits_5.0.0_lite %>% summarise_database("unit")) + expect_error(austraits_5.0.0_lite %>% summarise_database("source")) }) test_that("Output correct", { - family <- austraits_5.0.0_lite %>% summarise_austraits("family") - genus <- austraits_5.0.0_lite %>% summarise_austraits("genus") - trait_nm <- austraits_5.0.0_lite %>% summarise_austraits("trait_name") + family <- austraits_5.0.0_lite %>% summarise_database("family") + genus <- austraits_5.0.0_lite %>% summarise_database("genus") + trait_nm <- austraits_5.0.0_lite %>% summarise_database("trait_name") expect_length(family, 5) expect_length(genus, 5) From c1b4b7e6aac4d335653a608ca79a2ed8cd6085ec Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:31:27 +1100 Subject: [PATCH 06/10] Updated format for print message for v<5 --- R/print.austraits.R | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/R/print.austraits.R b/R/print.austraits.R index 3becb4b..11030e6 100644 --- a/R/print.austraits.R +++ b/R/print.austraits.R @@ -1,41 +1,28 @@ #' @title Generic for outputting a nice summary for austraits objects #' #' @name print.traits.build -#' @param database traits.build database +#' @param x traits.build database #' @param \dots passed to print #' #' @return nicely printed table #' @export -print.traits.build <- function(database, ...){ - +print.traits.build <- function(x, ...){ + # browser() # Setting up - database_name <- database$metadata$title - - traits.build_version <- at_six$metadata$related_identifiers |> - convert_list_to_df2() |> - dplyr::filter(resource_type == "software") |> - dplyr::pull(version) - - version <- database$build_info$version %>% as.character() - nrecords <- nrow(database$traits) - nspecies <- unique(database$traits$taxon_name) %>% length() - ntraits <- unique(database$traits$trait_name) %>% length() + version <- x$build_info$version %>% as.character() + nrecords <- nrow(x$traits) + nspecies <- unique(x$traits$taxon_name) %>% length() + ntraits <- unique(x$traits$trait_name) %>% length() - if(package_version(version) <= '3.0.2'){ + if(package_version(version) < '5.0.0'){ # Setting up - database_name <- database$definitions$austraits$description + database_name <- x$definitions$austraits$description fun <- function() { - cli::cli_h1("This is {version} of {database_name}!") - - cli::cli_bullets(c( - "i" = "A database built using traits.build version {traits.build_version}", - "i" = "This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits." - ) - ) + cli::cli_h1("This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits.") cli::cli_h2("This object is a 'list' with the following components:") cli::cli_div(theme = list(span.emph = list(color = "forestgreen"))) @@ -58,11 +45,18 @@ print.traits.build <- function(database, ...){ fun() } else{ + database_name <- x$metadata$title + + traits.build_version <- x$metadata$related_identifiers |> + convert_list_to_df2() |> + dplyr::filter(resource_type == "software") |> + dplyr::pull(version) + fun <- function() { cli::cli_h1("This is {version} of {database_name}!") cli::cli_bullets(c( - "i" = "A database built using traits.build version {traits.build_version}", + "i" = "This database is built using traits.build version {traits.build_version}", "i" = "This database contains a total of {nrecords} records, for {nspecies} taxa and {ntraits} traits." ) ) From cbc3094fa6e6fba440a6248e0b95bd45909a8b3e Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:32:19 +1100 Subject: [PATCH 07/10] Updated start up message --- R/austraits-package.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/austraits-package.R b/R/austraits-package.R index cfd5fc7..f61fe31 100644 --- a/R/austraits-package.R +++ b/R/austraits-package.R @@ -6,7 +6,7 @@ if(getRversion() >= "2.15.1") utils::globalVariables(c(".", "dplyr::n()")) .onAttach <- function(libname, pkgname) { - packageStartupMessage("Thanks for showing interest in `austraits`! Please consider citing this package - citation('austraits')") + cli::cli_alert_success("Thanks for showing interest in `austraits`! Please consider citing this package - citation('austraits')") } #' @keywords internal From 46e638c4bc14740651c1403824cd16c2e0331a30 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:34:22 +1100 Subject: [PATCH 08/10] Updated documentation --- man/print.traits.build.Rd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/print.traits.build.Rd b/man/print.traits.build.Rd index 01904d4..bf16dc7 100644 --- a/man/print.traits.build.Rd +++ b/man/print.traits.build.Rd @@ -4,10 +4,10 @@ \alias{print.traits.build} \title{Generic for outputting a nice summary for austraits objects} \usage{ -\method{print}{traits.build}(database, ...) +\method{print}{traits.build}(x, ...) } \arguments{ -\item{database}{traits.build database} +\item{x}{traits.build database} \item{\dots}{passed to print} } From ccaefe326749b995b7964b5f9ca1ea042f2175e0 Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:38:02 +1100 Subject: [PATCH 09/10] Revered start up message --- R/austraits-package.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/austraits-package.R b/R/austraits-package.R index f61fe31..cfd5fc7 100644 --- a/R/austraits-package.R +++ b/R/austraits-package.R @@ -6,7 +6,7 @@ if(getRversion() >= "2.15.1") utils::globalVariables(c(".", "dplyr::n()")) .onAttach <- function(libname, pkgname) { - cli::cli_alert_success("Thanks for showing interest in `austraits`! Please consider citing this package - citation('austraits')") + packageStartupMessage("Thanks for showing interest in `austraits`! Please consider citing this package - citation('austraits')") } #' @keywords internal From 0089f60be07a55af87b3071c0efd8ab6ae16e8ec Mon Sep 17 00:00:00 2001 From: Fonti Kar Date: Thu, 14 Nov 2024 15:47:22 +1100 Subject: [PATCH 10/10] Updated start up message --- R/austraits-package.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/austraits-package.R b/R/austraits-package.R index cfd5fc7..f81f19e 100644 --- a/R/austraits-package.R +++ b/R/austraits-package.R @@ -6,7 +6,7 @@ if(getRversion() >= "2.15.1") utils::globalVariables(c(".", "dplyr::n()")) .onAttach <- function(libname, pkgname) { - packageStartupMessage("Thanks for showing interest in `austraits`! Please consider citing this package - citation('austraits')") + cli::cli_inform("Thanks for showing interest in `austraits`! Please consider citing this package - citation('austraits')", class = "packageStartupMessage") } #' @keywords internal