Package 'starfish'

Title: Internal helpers
Description: Floating deep down in the sea starfish lives healthy and happily.
Authors: Catherine Blatter [aut, cre]
Maintainer: Catherine Blatter <[email protected]>
License: CC BY 4.0
Version: 0.0.9.9001
Built: 2025-02-01 05:59:17 UTC
Source: https://github.com/cathblatter/starfish

Help Index


Reverse engineer a table from its description from a SQL query

Description

Reverse engineer a table from its description from a SQL query

Usage

create_table(tbl_name)

Arguments

tbl_name

Table with holds the value with both the TABLE_NAME as well as the COLUMN_NAME. See details and examples

Details

The table to create derives its name from the TABLE_NAME column and the columns from the COLUMN_NAME column. Overall, the output comes from an Oracle DB

Value

a tibble assigned to the GlobalEnv

Examples

# mockup table descritpion
(tbl_descr <- tibble::tibble(TABLE_NAME = c("my_table"),
                             COLUMN_NAME = c("var1", "var2", "var3")))
# now print the table
## Not run: create_table(tbl_descr)

dict_hierarchie

Description

dict_tbl about pep_hierarchie dataset

Usage

dict_hierarchie

Format

An object of class tbl_df (inherits from tbl, data.frame) with 27 rows and 3 columns.


dict_pepzeiten

Description

dict_tbl about pep_zeiten dataset

Usage

dict_pepzeiten

Format

An object of class tbl_df (inherits from tbl, data.frame) with 32 rows and 6 columns.


STARFISH customized facets with units on right side

Description

STARFISH customized facets with units on right side

Usage

facet_wrap_starfish(
  facets = ~anon_unit,
  ncol = 1,
  nrow = NULL,
  strip.position = "right",
  drop = TRUE,
  scales = "fixed",
  shrink = TRUE,
  labeller = "label_value",
  as.table = TRUE,
  switch = NULL,
  dir = "h",
  ...
)

facet_wrap_sf(
  facets = ~anon_unit,
  ncol = 1,
  nrow = NULL,
  strip.position = "right",
  drop = TRUE,
  scales = "fixed",
  shrink = TRUE,
  labeller = "label_value",
  as.table = TRUE,
  switch = NULL,
  dir = "h",
  ...
)

Arguments

facets

defaults to variable anon_unit

ncol

defaults to 1

nrow

defaults to NULL

strip.position

"right"

drop

default: TRUE

scales

default: fixed

shrink

default fixed

labeller

"label_value"

as.table

TRUE

switch

NULL

dir

"h"

...

to pass to ggplot2::facet_wrap

Value

a facet


Filter all shifts where a certain condition is met

Description

Filter all shifts where a certain condition is met

Usage

filter_shifts_where(.data, ..., shift_var = shift_id)

Arguments

.data

a data frame or tibble

...

condition to pass to dplyr::filter

shift_var

variable with the shift_identified, default = "shift_id"

Value

a dataframe containing all shift-entries where a condition is met


Highlighting Covid timeframe in NH

Description

Highlighting Covid timeframe in NH

Usage

geom_covid_starfish(
  date1 = "2020-03-17",
  date2 = "2021-12-01",
  color = "grey30",
  linetype = "dashed",
  alpha = 0.6
)

Arguments

date1

default set

date2

default set

color

default set

linetype

default set

alpha

default set

Value

a custom geom


Get names of all unique palettes provided in starfish

Description

Get names of all unique palettes provided in starfish

Usage

get_starfish_palettes(full = FALSE)

Arguments

full

Whether to include full palette names (with suffixes, e.g. _cont) or just stubs

Value

Vector of palette name stubs or full names

Examples

get_starfish_palettes()

Custom color and fill scales

Description

Custom coloring and filling functions based on unique color palettes

Usage

scale_color_starfish_d(palette = "starfish", extend = FALSE, ...)

scale_colour_starfish_d(palette = "starfish", extend = FALSE, ...)

scale_fill_starfish_d(palette = "starfish", extend = FALSE, ...)

scale_color_starfish_op(
  palette = "starfish",
  val_names = c("good", "neutral", "bad"),
  ...
)

scale_colour_starfish_op(
  palette = "starfish",
  val_names = c("good", "neutral", "bad"),
  ...
)

scale_fill_starfish_op(
  palette = "starfish",
  val_names = c("good", "neutral", "bad"),
  ...
)

scale_color_starfish_div(palette = "starfish", ...)

scale_colour_starfish_div(palette = "starfish", ...)

scale_fill_starfish_div(palette = "starfish", ...)

scale_color_starfish_c(palette = "starfish", ...)

scale_colour_starfish_c(palette = "starfish", ...)

scale_fill_starfish_c(palette = "starfish", ...)

Arguments

palette

Name of color palette

extend

Whether to extend discrete color palette to make sufficient colors for levels needed

...

Additional arguments to be passed to internal scale function

val_names

For opinionated scales, defaults to "good", "neutral", "bad"

Details

Specific functions include:

  • scale_(color/colour/fill)_starfish_d : Discrete palette with either fixed or dynamically extended number of shades

  • scale_(color/colour/fill)_starfish_op\b : Discrete palette with fixed colors for "good", "bad", and "neutral"

  • scale_(color/colour/fill)_starfish_div : Continuous diverging color palette, must contain negative, neutral, positive values

  • scale_(color/colour/fill)_starfish_c : Continuous color palette

Examples

library(ggplot2)
library(starfish)
ggplot(diamonds[1:2000,], aes(x = cut, y = carat,
color = cut)) +
geom_point() +
scale_color_starfish_d() +
theme_starfish()

Custom starfish date scale

Description

Custom starfish date scale

Usage

scale_x_date_starfish(
  date_breaks = "1 year",
  date_labels = "%Y",
  expand = c(0.05, 0),
  ...
)

scale_x_date_sf(
  date_breaks = "1 year",
  date_labels = "%Y",
  expand = c(0.05, 0),
  ...
)

Arguments

date_breaks

defaults to 1 year

date_labels

defaults to YYYY

expand

how to expand the axes

...

further args passed

Value

a custom scale


STARFISH palette with six dimensions

Description

STARFISH palette with six dimensions

Usage

starfish_pal

starfish_pal_op

starfish_pal_cont

starfish_pal_div

Format

An object of class character of length 17.

An object of class character of length 3.

An object of class character of length 2.

An object of class character of length 3.


tbl_study_period

Description

a table containing all days of the study period

  • as dates

  • as integer representation

  • days in month

  • weekdays

  • months

  • weekends

Usage

tbl_study_period

Format

An object of class data.frame with 1826 rows and 5 columns.


STARFISH ggplot theme

Description

ggplot2 plot theme based on...

Usage

theme_starfish(base_theme = ggplot2::theme_minimal(), ...)

Arguments

base_theme

A base theme upon which additional theme-specific options are applied

...

Fruther arguments passed to ggplot2::theme()

References

https://github.com/gadenbuie/ggpomological/blob/master/R/theme_pomological.R

See Also

ggplot2::theme

Examples

## Not run: 
library(ggplot2)
data <- data.frame(x = 1:10, y = 1:10)
ggplot(data, aes(x, y)) + geom_point() + theme_starfish()

## End(Not run)

Internal directories

Description

paths to the project directory - data folder

Usage

wd_data_rd

Format

An object of class character of length 1.


Internal directories

Description

paths to the project directory - de-id'd data folder

Usage

wd_deidata_rd

Format

An object of class character of length 1.


Internal directories

Description

paths to the project directory - prepared data folder

Usage

wd_prepdata_rd

Format

An object of class character of length 1.


Internal directories

Description

paths to the project directory - prepared data folder

Usage

wd_procdata_rd

Format

An object of class character of length 1.


Internal directories

Description

paths to the project directory

Usage

wd_rd

Format

An object of class character of length 1.