Package 'cblttr'

Title: cblttr
Description: This package contains several helper functions for personal use. No guarantee in using the package. If you think some content is usable for you, please mention me.
Authors: Catherine Blatter [aut, cre]
Maintainer: Catherine Blatter <[email protected]>
License: GPL-3
Version: 0.0.4.9003
Built: 2025-02-17 04:00:30 UTC
Source: https://github.com/cathblatter/cblttr

Help Index


Add counts of multiple columns at once

Description

Add counts of multiple columns at once

Usage

add_counts(df, ...)

Arguments

df

the dataframe to work on

...

one or multiple column names to summarise by n() on

Value

a dataframe

References

Code originally written in R4DS-Channel by https://github.com/HannesOberreiter without testing for edge cases, modified for personal use by me

Examples

mtcars |> add_counts(cyl, vs, am)

Apply a function rowwise (usually per observation)

Description

Apply a function rowwise (usually per observation)

Usage

apply_rowwise(data, vars, func, na.rm = TRUE)

Arguments

data

a dataframe

vars

a selection of variables from the dataframe to apply a function over

func

the function to apply

na.rm

TRUE or FALSE, default = TRUE


clean library - a function to set a clean library state - to use with caution

Description

clean library - a function to set a clean library state - to use with caution

Usage

clean_library(lib = .libPaths())

Arguments

lib

defaults to .libPaths()

Value

a value


Diabetes

Description

A fake dataframe with variables somewhat related to Diabetes. Contains character and numeric variables including NAs.

Usage

Diabetes

Format

A sample data frame containing data from 130 probands in 11 variables


Gives a frequency table with 1 variable showing absolute'n'relative frequencies

Description

Gives a frequency table with 1 variable showing absolute'n'relative frequencies

Usage

freqtable1(x, useNA = "n")

Arguments

x

data and variable to enter (data$variable)

useNA

either "always" or "never", abbr. supported, default="n"

Value

a frequency table with first row absolute numbers, second table are relative values

Examples

a <- c(1:5)
 b <- c(11:15)
 sample.data <- data.frame(a,b)
 freqtable1(sample.data$a)

Insert '%in%'

Description

Insert '%in%'

Usage

insertInAddin()

Value

'%in%' as text


Matplotlib categorical color palette

Description

Matplotlib categorical color palette

Usage

matplotlib_colors

Format

An object of class character of length 10.


My orcid

Description

My orcid

Usage

myorcid

Format

An object of class character of length 1.


My orcid in URL

Description

My orcid in URL

Usage

myorcid_url

Format

An object of class character of length 1.


Convert a tableone matrix to a dataframe

Description

Convert a tableone matrix to a dataframe

Usage

tableone_mat_to_data_frame(mat)

Arguments

mat

An object created through tableone()

Value

a dataframe

References

developed & published in a gist from Kazuki Yoshida https://gist.github.com/kaz-yos/7b4e97b633d61fa4d1d27f46f2534ae3


Write tableone mat to excel file

Description

Write tableone mat to excel file

Usage

write_tableone_mat_to_xlsx(tableone_mat, file)

Arguments

tableone_mat

a tableone-object

file

the name of the file.xlsx

References

developed & published in a gist from Kazuki Yoshida https://gist.github.com/kaz-yos/7b4e97b633d61fa4d1d27f46f2534ae3