| Title: | Aleksander Bang-Larsen's personal convenience functions |
|---|---|
| Description: | This package supplies all the convenience functions that I have written to make my life easier. |
| Authors: | Aleksander Bang-Larsen [aut, cre, cph] (ORCID: <https://orcid.org/0009-0007-7984-4650>) |
| Maintainer: | Aleksander Bang-Larsen <[email protected]> |
| License: | AGPL (>= 3) |
| Version: | 0.0.0.9004 |
| Built: | 2026-05-20 08:58:45 UTC |
| Source: | https://github.com/aleksanderbl29/aleksandeR |
Format a number for presentation
format_num( x, decimals = 2, rounding = TRUE, big_mark = ".", decimal_mark = "," )format_num( x, decimals = 2, rounding = TRUE, big_mark = ".", decimal_mark = "," )
x |
An integer/double value. |
decimals |
The amount of decimals the input x should be rounded to. |
rounding |
Whether or not the input x should be rounded. Excludes the use of the decimals argument. |
big_mark |
The thousand separator. |
decimal_mark |
The decimal separator. |
A number formatted correctly with two (default) decimals, a comma as the decimal separator and a period as the thousand-separator. The type is characther.
x <- pi format_num(x) format_num(x, 1) format_num(x, rounding = FALSE)x <- pi format_num(x) format_num(x, 1) format_num(x, rounding = FALSE)
List of parties up for election
partiesparties
An object of class tbl_df (inherits from tbl, data.frame) with 12 rows and 4 columns.
Returns a tibble with information on the major parties up for election
https://www.valg.im.dk/partier-og-kandidater/opstillingsberettigede-partiers-adresser-mv
head(parties)head(parties)
{renv}-installed packagesThis was inspired by https://github.com/rstudio/renv/issues/340
pkg_bib(dependencies = FALSE, filename = "packages.bib", targets = FALSE)pkg_bib(dependencies = FALSE, filename = "packages.bib", targets = FALSE)
dependencies |
Boolean to define how many packages are cited. |
filename |
Specify a filename/path for the |
targets |
Boolean to define if the bibliography should be created based
on the packages defined in a targets pipeline and saved to
|
Usually called for its side effect of a .bib written to the
provided paths. Also outputs the package names in the console.
ggplot2 object.Get character count from ggplot2 object.
plot_nchar(plot)plot_nchar(plot)
plot |
Input a |
Returns a integer with the amount of characters in the plot. This is excluding spaces.
plot <- data.frame( x = seq(1, 10), y = seq(10, 1), label = rep(seq(1, 10, 2), 2) ) |> ggplot2::ggplot(ggplot2::aes(x = x, y = y, label = label)) + ggplot2::geom_text(nudge_y = 3) plot_nchar(plot)plot <- data.frame( x = seq(1, 10), y = seq(10, 1), label = rep(seq(1, 10, 2), 2) ) |> ggplot2::ggplot(ggplot2::aes(x = x, y = y, label = label)) + ggplot2::geom_text(nudge_y = 3) plot_nchar(plot)
ggplot2::geom_map().This theme is made specifically for maps made with. A color-ready version exists as theme_map_color().
theme_map(base_size = 9, base_family = "")theme_map(base_size = 9, base_family = "")
base_size |
base font size, given in pts. |
base_family |
base font family |
ggplot2::geom_map().This theme is made color-ready specifically for maps.
theme_map_color( color = "green", secondary_color = "pink", background_color = "black", base_size = 9, base_family = "" )theme_map_color( color = "green", secondary_color = "pink", background_color = "black", base_size = 9, base_family = "" )
color |
The primary color of the |
secondary_color |
The secondary color of the |
background_color |
The primary color of the |
base_size |
base font size, given in pts. |
base_family |
base font family |