| Title: | Sovacool's Tools |
|---|---|
| Description: | A collection of useful functions and examples that don't have an obvious home anywhere else. See the website <https://sovacool.dev/sovatools/> for more information, documentation, and examples. |
| Authors: | Kelly Sovacool [aut, cre] (ORCID: <https://orcid.org/0000-0003-3283-829X>) |
| Maintainer: | Kelly Sovacool <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-05-17 07:11:49 UTC |
| Source: | https://github.com/kelly-sovacool/sovatools |
Reports which packages need to be installed. See https://stackoverflow.com/questions/15595478/how-to-get-the-name-of-the-calling-function-inside-the-called-routine
abort_packages_not_installed(...)abort_packages_not_installed(...)
... |
Package name(s) to check |
Adapted from mikropml
Kelly Sovacool [email protected]
abort_packages_not_installed("base") ## Not run: your_function <- function() { abort_packages_not_installed("not-a-package-name", "dplyr", "non_package") } your_function() ## End(Not run)abort_packages_not_installed("base") ## Not run: your_function <- function() { abort_packages_not_installed("not-a-package-name", "dplyr", "non_package") } your_function() ## End(Not run)
Get package dependencies as a tibble
get_deps_tbl(package)get_deps_tbl(package)
package |
name of an R package |
a tibble with the package's recursive dependencies
## Not run: get_deps_tbl("mikropml") ## End(Not run)## Not run: get_deps_tbl("mikropml") ## End(Not run)
Get image height in inches given dimensions in pixels and width in inches
get_height_inches(width_pixels, height_pixels, width_inches = 6.5)get_height_inches(width_pixels, height_pixels, width_inches = 6.5)
Kelly Sovacool [email protected]
Get image dimensions in inches from a file path
get_image_dims(image_path, width_inches = 6.5)get_image_dims(image_path, width_inches = 6.5)
Kelly Sovacool [email protected]
Insert image in markdown
insert_image_md(image_path, width_inches = 6.5)insert_image_md(image_path, width_inches = 6.5)
Kelly Sovacool [email protected]
Uses ggplot2::theme_bw() and removes margins.
theme_sovacool()theme_sovacool()
list of ggproto objects
library(ggplot2) ggplot(mtcars) + aes(x = mpg, y = wt, color = cyl) + geom_point() + theme_sovacool()library(ggplot2) ggplot(mtcars) + aes(x = mpg, y = wt, color = cyl) + geom_point() + theme_sovacool()