Skip to content

Commit

Permalink
closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
rempsyc committed Mar 9, 2024
1 parent 11be4e2 commit 1203d99
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 7 deletions.
15 changes: 8 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,31 @@ Authors@R:
Description: Package to facilitate the creation of data visualization dashboards
through the flexdashboard and easyPubMed packages.
License: GPL (>= 3)
Suggests:
testthat (>= 3.0.0)
Imports:
easyPubMed,
rempsyc,
insight,
dplyr,
rlang,
purrr,
stringr,
stringi,
countrycode,
countrycode,
Ecfun,
lubridate,
tidyr
Suggests:
ggplot2,
ggflags (>= 0.0.3),
RColorBrewer,
DT,
waffle (>= 1.0.1),
tidyr,
ggflags (>= 0.0.3),
plotly,
RColorBrewer,
dygraphs,
xts,
rstudioapi,
rmarkdown
rmarkdown,
testthat (>= 3.0.0)
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Expand Down
1 change: 1 addition & 0 deletions R/dygraph_year.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#' @export

dygraph_year <- function(data, level = "continent") {
insight::check_if_installed(c("dygraphs", "xts"))
df_country_year <- data %>%
dplyr::group_by(.data$year, .data[[level]]) %>%
dplyr::filter(!is.na(.data[[level]])) %>%
Expand Down
1 change: 1 addition & 0 deletions R/render_dashboard.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ render_dashboard <- function(file_name = "dashboard",
tab_general = FALSE,
tab_figure1 = FALSE,
tab_missing = TRUE) {
insight::check_if_installed(c("rstudioapi", "rmarkdown"))
rmarkdown::render(system.file("dashboard.Rmd", package = "pubmedDashboard"),
output_dir = getwd(),
output_file = file_name
Expand Down
2 changes: 2 additions & 0 deletions R/scatter_continent_year.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#' @export

scatter_continent_year <- function(data, method = "lm", plotly = TRUE) {
insight::check_if_installed("RColorBrewer")
data <- data %>%
dplyr::mutate(missing = sum(is.na(.data$continent)) / dplyr::n()) %>%
dplyr::filter(!is.na(.data$continent)) %>%
Expand Down Expand Up @@ -67,6 +68,7 @@ scatter_continent_year <- function(data, method = "lm", plotly = TRUE) {
)

if (isTRUE(plotly)) {
insight::check_if_installed("plotly")
x <- plotly::ggplotly(tooltip = c("x", "y"))
}

Expand Down
1 change: 1 addition & 0 deletions R/scatter_country_year.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ scatter_country_year <- function(data, method = "lm", plotly = TRUE) {
)

if (isTRUE(plotly)) {
insight::check_if_installed("plotly")
x <- plotly::ggplotly(tooltip = c("x", "y"))
}

Expand Down
2 changes: 2 additions & 0 deletions R/scatter_figure1.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#' @export

scatter_figure1 <- function(data, method = "lm", original = TRUE, plotly = TRUE) {
insight::check_if_installed("ggplot2")
df_journal_year <- data %>%
dplyr::filter(!is.na(.data$country)) %>%
dplyr::group_by(.data$year, .data$journal) %>%
Expand Down Expand Up @@ -106,6 +107,7 @@ scatter_figure1 <- function(data, method = "lm", original = TRUE, plotly = TRUE)


if (isTRUE(plotly)) {
insight::check_if_installed("plotly")
fig1 <- plotly::ggplotly(fig1, tooltip = c("x", "y"))
}

Expand Down
1 change: 1 addition & 0 deletions R/table_continent.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ table_continent <- function(data, datatable = TRUE) {
dplyr::rename_with(stringr::str_to_title) %>%
dplyr::rename("Missing*" = "Missing")
if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(x,
options = list(searching = FALSE, paging = FALSE),
caption = "Journal paper percentages, by continent"
Expand Down
1 change: 1 addition & 0 deletions R/table_continent_journal.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ table_continent_journal <- function(data, datatable = TRUE) {
dplyr::rename_with(stringr::str_to_title)

if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(
x,
options = list(iDisplayLength = 5),
Expand Down
1 change: 1 addition & 0 deletions R/table_continent_year.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ table_continent_year <- function(data, datatable = TRUE) {
dplyr::rename_with(stringr::str_to_title)

if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(x,
caption = "Journal paper percentages, by continent and year"
)
Expand Down
1 change: 1 addition & 0 deletions R/table_country.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ table_country <- function(data, datatable = TRUE) {
dplyr::rename("Country Code" = "Country_code")

if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(x,
caption = "Journal paper percentages, by country"
)
Expand Down
1 change: 1 addition & 0 deletions R/table_country_journal.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ table_country_journal <- function(data, datatable = TRUE) {
dplyr::rename_with(stringr::str_to_title)

if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(x,
caption = "Journal paper percentages, by country and journal"
)
Expand Down
1 change: 1 addition & 0 deletions R/table_country_year.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ table_country_year <- function(data, datatable = TRUE) {
dplyr::arrange(dplyr::desc(.data$year), dplyr::desc(.data$Papers))

if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(x,
caption = "Journal paper percentages, by country and year"
)
Expand Down
1 change: 1 addition & 0 deletions R/table_missing_country.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ table_missing_country <- function(data, datatable = TRUE) {
dplyr::mutate(doi = paste0("<a href='", .data$doi, "' target='_blank'>", .data$doi, "</a>"))

if (isTRUE(datatable)) {
insight::check_if_installed("DT")
x <- DT::datatable(x,
extensions = "Responsive",
options = list(iDisplayLength = 5),
Expand Down
1 change: 1 addition & 0 deletions R/waffle_continent.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#' @export

waffle_continent <- function(data) {
insight::check_if_installed(c("waffle", "ggplot2"))
x <- data %>%
dplyr::mutate(missing = sum(is.na(.data$continent)) / dplyr::n()) %>%
dplyr::filter(!is.na(.data$continent)) %>%
Expand Down
1 change: 1 addition & 0 deletions R/waffle_continent_journal.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#' @export

waffle_continent_journal <- function(data, journal_abbreviation = TRUE) {
insight::check_if_installed(c("waffle", "ggplot2", "RColorBrewer"))
if (isTRUE(journal_abbreviation)) {
data <- data %>%
dplyr::mutate(journal = .data$jabbrv)
Expand Down
1 change: 1 addition & 0 deletions R/waffle_country.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#' @importFrom ggplot2 layer
#' @export
waffle_country <- function(data) {
insight::check_if_installed(c("ggflags", "ggplot2", "RColorBrewer"))
. <- NULL
x <- data %>%
dplyr::mutate(missing = sum(is.na(.data$country)) / dplyr::n()) %>%
Expand Down
1 change: 1 addition & 0 deletions R/waffle_country_journal.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#' @export

waffle_country_journal <- function(data, journal_abbreviation = TRUE) {
insight::check_if_installed(c("waffle", "ggplot2", "RColorBrewer"))
. <- NULL
if (isTRUE(journal_abbreviation)) {
data <- data %>%
Expand Down

0 comments on commit 1203d99

Please sign in to comment.