R/online_tools.R

Defines functions command_chk_packages_biostat window_online_bug_report window_online_homepage window_online_crossvalidated window_online_stackoverflow window_online_rmd window_online_advanced_r_2ed window_online_r4ds window_online_msmb window_online_rcompanion_handbook window_online_rcompanion window_online_biostathandbook window_online_bookdown window_online_esl window_online_isl window_online_r_bloggers window_online_rweekly window_online_sthda window_online_r_chearsheets window_online_ggplot2_ext window_online_plotly window_online_ggpubr window_online_ggstatsplot window_online_ggplot2 window_online_tidyr window_online_stringr window_online_readxl window_online_readr window_online_purrr window_online_magrittr window_online_forcats window_online_dplyr window_online_broom window_online_tidyverse window_online_past_download window_online_geogebra_download window_online_orange window_online_gpower window_online_bert window_online_rstudio window_online_r_project window_online_easyROC window_online_mvn window_online_image_digitizer window_online_statpages window_online_geogebra_probability source_online open_online_tool

Documented in command_chk_packages_biostat open_online_tool source_online window_online_advanced_r_2ed window_online_bert window_online_biostathandbook window_online_bookdown window_online_broom window_online_bug_report window_online_crossvalidated window_online_dplyr window_online_easyROC window_online_esl window_online_forcats window_online_geogebra_download window_online_geogebra_probability window_online_ggplot2 window_online_ggplot2_ext window_online_ggpubr window_online_ggstatsplot window_online_gpower window_online_homepage window_online_image_digitizer window_online_isl window_online_magrittr window_online_msmb window_online_mvn window_online_orange window_online_past_download window_online_plotly window_online_purrr window_online_r4ds window_online_r_bloggers window_online_r_chearsheets window_online_rcompanion window_online_rcompanion_handbook window_online_readr window_online_readxl window_online_rmd window_online_r_project window_online_rstudio window_online_rweekly window_online_stackoverflow window_online_statpages window_online_sthda window_online_stringr window_online_tidyr window_online_tidyverse

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
open_online_tool <- function(url = NULL, copy_to_clipboard = FALSE,
    parent = CommanderWindow()) {
  checkmate::assert_string(url, null.ok = TRUE)
  checkmate::assert_logical(copy_to_clipboard)

  if (!pingr::is_online()) {
    open_browser <-
      tk_messageBox(
        parent = parent,
        message = str_c(
          "This feature requires an Internet connection but your\n",
          "computer is offline now. Do you want to open the tool\n",
          "or website in a web browser anyway?"
        ),
        icon  = "warning",
        caption = "No Internet Connection",
        type  = "yesno",
        default = "no")

  } else {
    choice <- "yes"
  }

  if (choice == "yes") {
    if (isTRUE(copy_to_clipboard)) {
      export_to_clipboard_active_ds_tab()
    }
    browseURL(url = url)
  }
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
source_online <- function(url = NULL, parent = CommanderWindow()) {
  checkmate::assert_string(url, null.ok = TRUE)

  if (!pingr::is_online()) {
    open_browser <-
      tk_messageBox(
        parent = parent,
        message = str_c(
          "This feature requires an Internet connection but your\n",
          "computer is offline now. Do you want to proceed anyway?"
        ),
        icon  = "warning",
        caption = "No Internet Connection",
        type  = "yesno",
        default = "no")

  } else {
    choice <- "yes"
  }

  if (choice == "yes") {
    command <- str_glue('source("{url}", encoding = "UTF-8")')
    doItAndPrint(command)
  }
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Online apps ----------------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_geogebra_probability  <- function() {
  open_online_tool("https://www.geogebra.org/classic/probability")
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_statpages  <- function() {
  open_online_tool("http://statpages.info/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_image_digitizer  <- function() {
  open_online_tool("https://apps.automeris.io/wpd/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_mvn  <- function() {
  open_online_tool("http://www.biosoft.hacettepe.edu.tr/MVN/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_easyROC  <- function() {
  open_online_tool("http://www.biosoft.hacettepe.edu.tr/easyROC/")
}






# Download -------------------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_r_project  <- function() {
  open_online_tool("https://www.r-project.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_rstudio  <- function() {
  open_online_tool("https://rstudio.com/products/rstudio/download/#download")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_bert <- function() {
  open_online_tool("https://bert-toolkit.com/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_gpower  <- function() {
  open_online_tool("http://www.gpower.hhu.de/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_orange  <- function() {
  open_online_tool("https://orange.biolab.si/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_geogebra_download  <- function() {
  open_online_tool("https://www.geogebra.org/download") # must be without /
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_past_download  <- function() {
  # The link is broken
  open_online_tool("https://folk.uio.no/ohammer/past/")
}


# R extensions ---------------------------------------------------------------


#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_tidyverse <- function() {
  open_online_tool("https://www.tidyverse.org/packages/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_broom <- function() {
  open_online_tool("https://broom.tidymodels.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_dplyr <- function() {
  open_online_tool("https://dplyr.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_forcats <- function() {
  open_online_tool("https://forcats.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_magrittr <- function() {
  open_online_tool("https://magrittr.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_purrr <- function() {
  open_online_tool("https://purrr.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_readr <- function() {
  open_online_tool("https://readr.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_readxl <- function() {
  open_online_tool("https://readxl.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_stringr <- function() {
  open_online_tool("https://stringr.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_tidyr <- function() {
  open_online_tool("https://tidyr.tidyverse.org/")
}

# Plotting -------------------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_ggplot2 <- function() {
  open_online_tool("https://ggplot2.tidyverse.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_ggstatsplot  <- function() {
  open_online_tool("https://indrajeetpatil.github.io/ggstatsplot/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_ggpubr  <- function() {
  open_online_tool("https://rpkgs.datanovia.com/ggpubr/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_plotly  <- function() {
  open_online_tool("https://plot.ly/ggplot2/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_ggplot2_ext <- function() {
  open_online_tool("https://exts.ggplot2.tidyverse.org/gallery/")
}

# News and tutorials ---------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_r_chearsheets  <- function() {
  open_online_tool("https://rstudio.com/resources/cheatsheets/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_sthda  <- function() {
  open_online_tool("http://www.sthda.com/english/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_rweekly  <- function() {
  open_online_tool("https://rweekly.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_r_bloggers  <- function() {
  open_online_tool("https://www.r-bloggers.com/")
}


#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_isl  <- function() {
  open_online_tool("http://faculty.marshall.usc.edu/gareth-james/ISL/")
}
#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_esl  <- function() {
  open_online_tool("https://web.stanford.edu/~hastie/ElemStatLearn/")
}


# Books ----------------------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_bookdown <- function() {
  open_online_tool("https://bookdown.org/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_biostathandbook <- function() {
  open_online_tool("http://www.biostathandbook.com/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_rcompanion <- function() {
  open_online_tool("http://rcompanion.org/rcompanion/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_rcompanion_handbook <- function() {
  open_online_tool("http://rcompanion.org/handbook/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_msmb <- function() {
  open_online_tool("https://www.huber.embl.de/msmb/index.html")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_r4ds <- function() {
  open_online_tool("https://r4ds.had.co.nz/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_advanced_r_2ed <- function() {
  open_online_tool("https://adv-r.hadley.nz/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_rmd <- function() {
  open_online_tool("https://bookdown.org/yihui/rmarkdown/")
}


# Forums ---------------------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_stackoverflow  <- function() {
  open_online_tool("https://stackoverflow.com/questions/tagged/r")
}


#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_crossvalidated  <- function() {
  open_online_tool("https://stats.stackexchange.com/questions/tagged/r")
}


# About ----------------------------------------------------------------------

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_homepage <- function() {
  open_online_tool("https://gegznav.github.io/RcmdrPlugin.biostat/")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
window_online_bug_report <- function() {
  open_online_tool("https://github.com/GegznaV/RcmdrPlugin.biostat/issues")
}

#' @rdname Menu-window-functions
#' @export
#' @keywords internal
command_chk_packages_biostat <- function() {
  source_online("https://gegznav.github.io/RcmdrPlugin.biostat/check-pkgs.R")
}

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GegznaV/RcmdrPlugin.BioStat documentation built on May 8, 2023, 7:41 a.m.