diff --git a/NEWS.md b/NEWS.md index 375beee..ef19d2c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +sdmverse 0.1.0.9023 + +- inst/scripts/ms_figs.R to examples sections + sdmverse 0.1.0.9022 - app update with M. Noblis suggestions diff --git a/R/plot_dendrogram.R b/R/plot_dendrogram.R index d90abd8..36f2127 100644 --- a/R/plot_dendrogram.R +++ b/R/plot_dendrogram.R @@ -25,46 +25,27 @@ NULL #' #' @examples #' \donttest{ -#' # fetch data -#' table <- prep_table() -#' -#' # a rectangular dendrogram -#' rect <- plot_dendrogram( -#' table = table, -#' dist_method = "binary", -#' k = nrow(table), -#' k_colors = "jco", -#' rect = TRUE, -#' rect_border = "jco", -#' rect_fill = TRUE, -#' type = "rectangle", +#' library(dplyr) +#' d <- prep_table(where = "online") %>% +#' filter( +#' name != "rgbif", +#' name != "ibis.iSDM", +#' name != "dismo" +#' ) %>% +#' select( +#' -mod_mechanistic, +#' -mod_multispecies +#' ) +#' plot_dendrogram( +#' d, +#' k = 5, +#' cex = 0.7, +#' diff_method = "binary", #' horiz = TRUE, -#' main = "Species distribution modeling software", -#' sub = date(), -#' cex = 1.4 -#' ) -#' -#' # a phylogenic plot -#' phylo <- plot_dendrogram( -#' table = table, -#' dist_method = "binary", -#' k = nrow(table), -#' k_colors = "jco", -#' rect = TRUE, -#' rect_border = "jco", -#' type = "phylogenic", -#' repel = TRUE, -#' main = "Species distribution modeling software", -#' sub = date(), -#' cex = 1 +#' main = "" #' ) #' } #' -#' \dontrun{ -#' library(patchwork) -#' rect + phylo -#' } -#' #' @export #' plot_dendrogram <- function(table, diff --git a/R/plot_table.R b/R/plot_table.R index bf46937..c939bbc 100644 --- a/R/plot_table.R +++ b/R/plot_table.R @@ -15,9 +15,19 @@ NULL #' @return Plot package characteristics from the sdmverse table using ggplot. #' #' @examples -#' \dontrun{ -#' prep_table() %>% -#' plot_table() +#' \donttest{ +#' library(dplyr) +#' d <- prep_table(where = "online") %>% +#' filter( +#' name != "rgbif", +#' name != "ibis.iSDM", +#' name != "dismo" +#' ) %>% +#' select( +#' -mod_mechanistic, +#' -mod_multispecies +#' ) +#' plot_table(d, remove_empty_cats = TRUE) #' } #' #' @export diff --git a/R/prep_table.R b/R/prep_table.R index a722fbb..be4cf1e 100644 --- a/R/prep_table.R +++ b/R/prep_table.R @@ -14,7 +14,17 @@ NULL #' #' @examples #' \donttest{ -#' prep_table() +#' library(dplyr) +#' d <- prep_table(where = "online") %>% +#' filter( +#' name != "rgbif", +#' name != "ibis.iSDM", +#' name != "dismo" +#' ) %>% +#' select( +#' -mod_mechanistic, +#' -mod_multispecies +#' ) #' } #' #' @export diff --git a/inst/app/rsconnect/shinyapps.io/sylvainschmitt/smdverse.dcf b/inst/app/rsconnect/shinyapps.io/sylvainschmitt/smdverse.dcf index e76fd66..ed9d176 100644 --- a/inst/app/rsconnect/shinyapps.io/sylvainschmitt/smdverse.dcf +++ b/inst/app/rsconnect/shinyapps.io/sylvainschmitt/smdverse.dcf @@ -5,5 +5,5 @@ account: sylvainschmitt server: shinyapps.io hostUrl: https://api.shinyapps.io/v1 appId: 8255748 -bundleId: 9038005 +bundleId: 9168398 url: https://sylvainschmitt.shinyapps.io/smdverse/ diff --git a/inst/app/server.R b/inst/app/server.R index f9f5857..a53e0b3 100644 --- a/inst/app/server.R +++ b/inst/app/server.R @@ -95,9 +95,7 @@ shinyServer(function(input, output) { ) ) }) - output$table <- DT::renderDataTable( - { - tab() - }, - ) + output$table <- DT::renderDataTable({ + tab() + }, ) }) diff --git a/inst/scripts/ms_figs.R b/inst/scripts/ms_figs.R deleted file mode 100644 index bc1dad5..0000000 --- a/inst/scripts/ms_figs.R +++ /dev/null @@ -1,46 +0,0 @@ -library(dplyr) - -d <- prep_table(where = "online") - -d <- filter( - d, name != "rgbif", - name != "ibis.iSDM", - name != "dismo" -) |> - select( - -mod_mechanistic, - -mod_multispecies - ) - -pal <- RColorBrewer::brewer.pal(n = 5, name = "Dark2") - -pdf("fig3.pdf", height = 5, width = 9.7) -plot_dendrogram(d, - k = 5, cex = 0.7, diff_method = "binary", - k_colors = pal, horiz = TRUE, main = "" -) -dev.off() - -clust <- plot_dendrogram(d, - k = 5, cex = 1, diff_method = "binary", - k_colors = pal, horiz = TRUE, main = "", - return_clust = TRUE -) -pkg_order <- rev(clust$labels[clust$order]) - -pkg_cols <- pkg_order -names(pkg_cols) <- pkg_order - -pkg_cols[1:21] <- pal[5] -pkg_cols[22:26] <- pal[4] -pkg_cols[27:30] <- pal[3] -pkg_cols[31] <- pal[2] -pkg_cols[32:33] <- pal[1] - -pdf("fig2.pdf", height = 7, width = 16) -plot_table(d, - pkg_order = pkg_order, - pkg_cols = pkg_cols, - remove_empty_cats = TRUE -) -dev.off() diff --git a/man/plot_dendrogram.Rd b/man/plot_dendrogram.Rd index 27352b6..bddb3e6 100644 --- a/man/plot_dendrogram.Rd +++ b/man/plot_dendrogram.Rd @@ -36,44 +36,25 @@ packages. } \examples{ \donttest{ -# fetch data -table <- prep_table() - -# a rectangular dendrogram -rect <- plot_dendrogram( - table = table, - dist_method = "binary", - k = nrow(table), - k_colors = "jco", - rect = TRUE, - rect_border = "jco", - rect_fill = TRUE, - type = "rectangle", +library(dplyr) +d <- prep_table(where = "online") \%>\% + filter( + name != "rgbif", + name != "ibis.iSDM", + name != "dismo" + ) \%>\% + select( + -mod_mechanistic, + -mod_multispecies + ) +plot_dendrogram( + d, + k = 5, + cex = 0.7, + diff_method = "binary", horiz = TRUE, - main = "Species distribution modeling software", - sub = date(), - cex = 1.4 + main = "" ) - -# a phylogenic plot -phylo <- plot_dendrogram( - table = table, - dist_method = "binary", - k = nrow(table), - k_colors = "jco", - rect = TRUE, - rect_border = "jco", - type = "phylogenic", - repel = TRUE, - main = "Species distribution modeling software", - sub = date(), - cex = 1 -) -} - -\dontrun{ -library(patchwork) -rect + phylo } } diff --git a/man/plot_table.Rd b/man/plot_table.Rd index b68a949..91043f6 100644 --- a/man/plot_table.Rd +++ b/man/plot_table.Rd @@ -22,9 +22,19 @@ Plot package characteristics from the sdmverse table using ggplot. Plot sdmverse table } \examples{ -\dontrun{ -prep_table() \%>\% - plot_table() +\donttest{ +library(dplyr) +d <- prep_table(where = "online") \%>\% + filter( + name != "rgbif", + name != "ibis.iSDM", + name != "dismo" + ) \%>\% + select( + -mod_mechanistic, + -mod_multispecies + ) +plot_table(d, remove_empty_cats = TRUE) } } diff --git a/man/prep_table.Rd b/man/prep_table.Rd index 6393195..d5e8185 100644 --- a/man/prep_table.Rd +++ b/man/prep_table.Rd @@ -20,7 +20,17 @@ This function prepare sdmverse packages table. } \examples{ \donttest{ -prep_table() +library(dplyr) +d <- prep_table(where = "online") \%>\% + filter( + name != "rgbif", + name != "ibis.iSDM", + name != "dismo" + ) \%>\% + select( + -mod_mechanistic, + -mod_multispecies + ) } }