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 |
Add counts of multiple columns at once
add_counts(df, ...)
add_counts(df, ...)
df |
the dataframe to work on |
... |
one or multiple column names to summarise by n() on |
a dataframe
Code originally written in R4DS-Channel by https://github.com/HannesOberreiter without testing for edge cases, modified for personal use by me
mtcars |> add_counts(cyl, vs, am)
mtcars |> add_counts(cyl, vs, am)
Apply a function rowwise (usually per observation)
apply_rowwise(data, vars, func, na.rm = TRUE)
apply_rowwise(data, vars, func, na.rm = TRUE)
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
clean_library(lib = .libPaths())
clean_library(lib = .libPaths())
lib |
defaults to .libPaths() |
a value
A fake dataframe with variables somewhat related to Diabetes. Contains character and numeric variables including NAs.
Diabetes
Diabetes
A sample data frame containing data from 130 probands in 11 variables
Gives a frequency table with 1 variable showing absolute'n'relative frequencies
freqtable1(x, useNA = "n")
freqtable1(x, useNA = "n")
x |
data and variable to enter (data$variable) |
useNA |
either "always" or "never", abbr. supported, default="n" |
a frequency table with first row absolute numbers, second table are relative values
a <- c(1:5) b <- c(11:15) sample.data <- data.frame(a,b) freqtable1(sample.data$a)
a <- c(1:5) b <- c(11:15) sample.data <- data.frame(a,b) freqtable1(sample.data$a)
Matplotlib categorical color palette
matplotlib_colors
matplotlib_colors
An object of class character
of length 10.
My orcid
myorcid
myorcid
An object of class character
of length 1.
My orcid in URL
myorcid_url
myorcid_url
An object of class character
of length 1.
Convert a tableone matrix to a dataframe
tableone_mat_to_data_frame(mat)
tableone_mat_to_data_frame(mat)
mat |
An object created through tableone() |
a dataframe
developed & published in a gist from Kazuki Yoshida https://gist.github.com/kaz-yos/7b4e97b633d61fa4d1d27f46f2534ae3
Write tableone mat to excel file
write_tableone_mat_to_xlsx(tableone_mat, file)
write_tableone_mat_to_xlsx(tableone_mat, file)
tableone_mat |
a tableone-object |
file |
the name of the file.xlsx |
developed & published in a gist from Kazuki Yoshida https://gist.github.com/kaz-yos/7b4e97b633d61fa4d1d27f46f2534ae3