Convenience functions to facilitate installation and management of required resources for course unit Biostatistics (BS-2023).
This package is intended to be used with RStudio 2024.04 or newer
and R 4.4.0 or newer.
Functions may not work correctly with the previous versions of RStudio and R.
Bug reports and your feedback are welcome at https://github.com/mokymai/bio/issues. In the report, indicate what operating system you are using.
To install this package from CRAN-like repository, use code (recommended):
repos <- c("https://mokymai.github.io/download/", getOption("repos"))
install.packages("bio", repos = repos)
Install form GitHub
To install this package from GitHub:
if (!require(remotes)) install.packages("remotes")
remotes::install_github("mokymai/bio", dependencies = TRUE)
Note: installation from GitHub requires RTools on Windows.
Check information about operating system (OS) and R-related user information.
bio::check_user_info()
## Operating system Windows 10 x64 (build 19044)
## Platform x86_64-w64-mingw32/x64 (64-bit)
## LOGNAME
## USERNAME User
## USERPROFILE C:/Users/User
## HOME C:/Users/User
## R_USER C:/Users/User
## R_HOME C:/PROGRA~1/R/R-4.2.2
## R_LIBS_USER C:/Users/User/AppData/Local/R/win-library/4.2
Check versions of presence of installed R-related and other programs. Options:
"main"
(default) – checks for “R”, “RStudio”, “Quarto”, and “Rtools” (“Windows” only) or “R Build Tools” (non-“Windows” only)."all"
– additionally checks for presence of “XQuartz” (“Mac” only), “Git” (all systems), and (sometimes) “Meld”.
bio::check_installed_programs()
## ✔ Program R (4.3.1) is installed (recommended >= 4.3.1).
## ✖ Program RStudio is not installed or is not running.
## ✔ Tool Quarto (1.4.268) is installed (recommended >= 1.3.336).
## ✔ Tool Rtools is installed.
bio::check_installed_programs("all")
## ✔ Program R (4.3.1) is installed (recommended >= 4.2.2, available 4.3.1).
## ✔ Program RStudio (2023.6.1.524) is installed (recommended >= 2023.3.0, available 2023.6.1.524).
## ✔ Tool Quarto (1.4.268) is installed (recommended >= 1.3.336).
## ✔ Tool Rtools is installed.
## ✔ Program Git is installed.
## ✔ Program Meld is installed.
It is recommended to check installation status and version of required packages by name:
bio::check_packages_by_name(c("bio", "remotes", "tidyverse"))
## ✔ Minimal required versions of all 3 packages are already installed.
There is a less recommended way (due to lower transparency) to check
installation status of packages by topic. By default, only missing
packages or packages with lower versions than recommended are displayed.
Currently available lists can be returned by function
bio::get_pkg_lists_local()
.
Details
'addins-rmd'
'bio'
'confidence-intervals'
'ggplot-extra-tools'
'ggplot'
'gmc-r209'
'initial'
'linear-regression'
'markdown'
'mini'
'rcmdr-biostat'
'rcmdr'
'snippets'
'spelling-grammar'
'statistical-tests'
'summary'
'tidyverse'
bio::check_packages_by_topic("mini")
## ℹ Reading list 'mini'
## ✔ Minimal required versions of all 19 packages (from list 'mini') are already installed.
bio::check_packages_by_topic("mini", include = "newer_on_cran")
## ℹ Reading list 'mini'
## ✔ Minimal required versions of all 19 packages (from list 'mini') are already installed.
## ℹ Note: 1 package has newer version on CRAN.
These are the convenience functions to update certain R packages. The functions restart R before installation if used in RStudio.
Update package bio.
bio::update_pkg_bio()
Check if there are updates for bio or its dependency packages.
bio::check_updates_pkg_bio()
## ℹ Analyzing dependencies of package bio
##
## [... truncated ...]
##
## ✔ Minimal required versions of all 26 packages (from list 'bio') are already installed.
Update package snippets.
bio::update_pkg_snippets()
Make sure that you understand what you are doing when you try using the functions that reset RStudio key bindings (shortcut keys), settings or snippets. You may loose all your previous settings.
This function downloads or updates hunspell spelling checking dictionaries dictionaries (including Lithuanian) that can be used by RStudio or by tools from wellspell.addin package.
bio::rstudio_install_spellcheck_dictionaries()
Install improved Lithuanian dictionary.
bio::rstudio_install_spellcheck_dictionary_lt()
## ✔ lt_LT dictionary installed.
## 'C:/Users/ViG/AppData/Roaming/RStudio/dictionaries/languages-system/lt_LT.dic'
This function changes shortcut keys in RStudio.
Run function without arguments to see the available options.
bio::rstudio_reset_keybindings()
## Error: The value of argument 'to' is missing.
## Possible options: 'bio-default', 'rstudio-default'.
Options:
"bio-default"
– shortcut keys recommended for course BS-2023."rstudio-default"
– RStudio defaults.
bio::rstudio_reset_keybindings(to = "bio-default")
## ✔ Back up copy of shortcut keys was created in 'C:/Users/User/.R/_backup/keybindings/'
## ✔ Shortcut keys were reset to bio-default.
Shortcut | Action |
---|---|
Shift+Alt+S | Insert inline LaTeX equation (R Markdown). |
Shift+Alt+A | Use “Tidyverse” style on selected lines of R code. Package styler must be installed (R code). |
Ctrl+Shift+D | Duplicate selected text. |
Ctrl+Shift+Alt+S | Check spelling in selected text. Package wellspell.addin must be installed. |
Ctrl+Shift+Alt+P | Align parts of selected lines at a custom pattern. |
Ctrl+Shift+] | Change heading one level down (R Markdown) [!]. |
Ctrl+Shift+[ | Change heading one level up or remove heading (R Markdown) [!]. |
Ctrl+Shift+; | Insert lower opening quotes „ . |
Ctrl+Shift+’ | Insert upper closing quotes “ . |
Ctrl+E | Insert/Enclose with R code block (R Markdown) [!] . |
Ctrl+Alt+T | Insert inline code highlighted as R code (R Markdown). |
Ctrl+Alt+NumPad8 | Insert operator %*% (R code). |
Ctrl+Alt+NumPad7 | Insert operator %in% (R code). |
Ctrl+Alt+D | Document R package (that you are building). |
Table 1. Some examples of shortcut keys set with option
"bio-default"
.
More on Customizing Keyboard Shortcuts in RStudio.
This function resets RStudio user preferences and settings.
Run function without arguments to see the available options.
bio::rstudio_reset_user_settings()
#> Error: The value of argument 'to' is missing.
#> Possible choices: 'bio-default', 'bio-dark-blue', 'bio-black', 'rstudio-default'.
The options:
"bio-default"
– recommendedbio
settings (and light theme “Textmate (default)”);"bio-dark-blue"
– recommendedbio
settings (and dark blue theme “Cobalt”);"bio-black"
– recommendedbio
settings (and black theme “Chaos”);"rstudio-default"
– default RStudio settings.
bio::rstudio_reset_user_settings(to = "bio-default")
To check, how your settings differ from the defaults in a certain list, use:
bio::rstudio_compare_user_settings(to = "bio-default")
## ℹ Show differences between current and bio-default setting lists.
## ✔ No differences
The settings that are not in the list will not be displayed. Available
options of to
are “bio-default” and “rstudio-default”.
The function replaces current R code and R Markdown snippets with those in package “snippets”.
snippets::install_snippets_from_package("snippets", backup = TRUE)
## ✔ File with markdown snippets was updated:
## 'C:/Users/User/AppData/Roaming/RStudio/snippets/markdown.snippets'
## ✔ File with r snippets was updated:
## 'C:/Users/User/AppData/Roaming/RStudio/snippets/r.snippets'
##
## ℹ You will be able to use the snippets after RStudio is closed and reopened.
More information on Code Snippets in RStudio and on package snippets.
If you want to see the effect of changed settings, you should reload RStudio. You may use this function, which reloads RStudio without closing it:
bio::restart_rstudio()
However, in some cases it is recommended to close and reopen RStudio.
Next, to restart R session without closing RStudio, use:
bio::restart_r()
Useful to apply before trying to install R packages.