Learn R Programming

kim: A Toolkit for Behavioral Scientists

This package contains various functions that simplify and expedite analyses of experimental data. Examples include a function that plots sample means of groups in a factorial experimental design, a function that conducts robust regressions with bootstrapped samples, and a function that conducts robust two-way analysis of variance.

Installation

You can install the released version of kim from CRAN with:

install.packages("kim")

You can also install the development version from kim on GitHub with:

install.packages("remotes")
remotes::install_github("jinkim3/kim")

If you run into errors while using the package, try updating the package to the most recent version available on kim on GitHub with:

update_kim()

Example

Here are some examples of using this package.

library(kim)

# (Optional) install all dependencies for all functions in Package 'kim'
install_all_dependencies()

# update the package 'kim', clear the console and environment,
# set up working directory to location of the active document,
# and load the two default packages ('data.table' and 'ggplot2')
start_kim()

# create a scatter plot
scatterplot(data = mtcars, x_var_name = "wt", y_var_name = "mpg")

# get descriptive statistics by group
desc_stats_by_group(
  data = mtcars, var_for_stats = "mpg", grouping_vars = c("vs", "am"))

# plot histograms by group
histogram_by_group(data = mtcars, iv_name = "cyl", dv_name = "mpg")

# plot sample means of groups in a factorial experimental design
plot_group_means(data = mtcars, dv_name = "mpg", iv_name = "gear")

# conduct a two-way ANOVA
factorial_anova_2_way(
  data = mtcars, dv_name = "mpg", iv_1_name = "vs", iv_2_name = "am")

# conduct a multiple regression analysis
multiple_regression(data = mtcars, formula = mpg ~ gear * cyl)

# conduct a robust regression analysis using bootstrapped samples
robust_regression(data = mtcars, formula = mpg ~ cyl * hp)

# conduct a mediation analysis
mediation_analysis(
  data = mtcars, iv_name = "cyl", mediator_name = "disp", dv_name = "mpg")

# conduct a floodlight analysis for a 2 x continuous design
floodlight_2_by_continuous(
  data = mtcars, iv_name = "am", dv_name = "mpg", mod_name = "qsec")

Copy Link

Version

Install

install.packages('kim')

Monthly Downloads

367

Version

0.6.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jin Kim

Last Published

February 26th, 2025

Functions in kim (0.6.1)

coefficent_of_variation

Coefficient of variation
cohen_d_for_one_sample

Calculate Cohen's d to accompany a one-sample t-test
compare_dependent_rs

Compare dependent correlations
compare_effect_sizes

Compare effect sizes
cohen_d_from_cohen_textbook

Cohen's d from Jacob Cohen's textbook (1988)
compare_datasets

Compare data sets
contingency_table

Contingency table
cohen_d_torchiano

Calculate Cohen's d and its confidence interval using the package 'effsize'
cohen_d_to_r

Convert Cohen's d to r
comma_sep_string_to_numbers

Convert a comma-separated string of numbers
combine_data_across_cols

Combine data across columns
convert_cols_to_numeric

Convert columns to numeric
desc_stats_by_group

Descriptive statistics by group
correlation_kim

Estimate the correlation between two variables
excel_formula_convert

Excel formula, convert (to)
convert_to_excel_formula

Convert character to Excel formula
desc_stats

Descriptive statistics
chi_squared_test_pairwise

Chi-squared test, pairwise
compare_independent_rs

Compare independent correlations
exit_from_parent_function

Exit from a Parent Function
ci_of_mean

Confidence Interval of the Mean of a Vector
compare_groups

Compare groups
duplicated_values

Duplicated values in a vector
detach_user_installed_pkgs

Detach all user-installed packages
correlation_matrix

correlation matrix
floodlight_for_contrasts

Floodlight Analyses for a Set of Contrasts
floodlight_multi_by_continuous

Floodlight Multicategorical by Continuous
find_duplicates

Find duplicated values in a vector
factorial_anova_2_way

Factorial ANOVA 2-Way (Two-Way Factorial ANOVA)
floodlight_2_by_continuous_logistic

Floodlight 2 by Continuous for a Logistic Regression
floodlight_2_by_continuous_mlm_logistic

Floodlight 2 by Continuous for a Multilevel Logistic Regression
cum_percent_plot

Cumulative percentage plot
geomean

Geometric mean
forest_plot

Forest plot
ggsave_quick

ggsave quick
histogram_from_hist

Histogram from hist function
histogram

Histogram
histogram_w_outlier_bins

Histogram with outlier bins
install_all_dependencies

Install all dependencies for all functions
floodlight_2_by_continuous

Floodlight 2 by Continuous
identical_all

Check whether all inputs are identical
fisher_z_transform

Fisher's Z transformation
holm_adjusted_p

Holm-adjusted p-values
logistic_regression

Logistic regression
logistic_regression_table

Logistic regression table
id_across_datasets

ID across datasets
merge_data_tables

Merge data tables
merge_data_table_list

Merge a list of data tables
log_odds_ratio

Log odds ratio
kurtosis

Kurtosis
levene_test

Levene's test
mixed_anova_2_way

Mixed ANOVA 2-Way (Two-Way Mixed ANOVA)
lenu

lenu: Length of unique values
modes_of_objects

Find modes of objects
mean_center

Mean center
mediation_analysis

Mediation analysis
log_odds_ratio_to_d

Convert log odds ratio to Cohen's d
mann_whitney

Mann-Whitney U Test (Also called Wilcoxon Rank-Sum Test)
logistic_reg_w_interaction

Logistic regression with an interaction term
matrix_prep_dt

Prepare a two-column data.table that will be used to fill values in a matrix
percentile_rank

Percentile rank
parallel_analysis

Parallel analysis
multiple_regression

Multiple regression
odds_ratio

Odds ratio
noncentrality_parameter

Find noncentrality parameter
outlier

Outlier
overlapping_interval

Find the overlapping interval of two ranges.
pivot_table

Pivot Table
histogram_deprecated_1

Histogram
p0

Paste0
read_sole_csv

Read the sole csv file in the working directory
mad_remove_outliers

Remove outliers using the MAD method
package_list_default

Packages - List the default packages
read_csv

Read a csv file
loglinear_analysis

Loglinear analysis
histogram_by_group

Histogram by group
remove_user_installed_pkgs

Remove all user installed packages
population_variance

Population variance of a vector
pm

Paste for message
plot_group_means

Plot group means
repeated_measures_anova

Repeated-Measures ANVOA
proportion_of_values_in_vector

Proportion of given values in a vector
prep

Prepare package(s) for use
regex_match

Regular expression matches
rel_pos_of_value_in_vector

Find relative position of a value in a vector
pretty_round_p_value

Pretty round p-value
order_rows_specifically_in_dt

Order rows specifically in a data table
skewness

Skewness
simple_slopes_analysis_logistic

Simple slopes analysis with logistic regression analyses
se_of_mean

Standard error of the mean
score_scale_items

Score scale items
top_median_or_bottom

Top, median, or bottom
theme_kim

Theme Kim
replace_values_in_dt

Replace values in a data table
se_of_percentage

Standard Error (SE) of a percentage
q_stat_test_homo_r

Q statistic for testing homogeneity of correlations
tabulate_vector

Tabulate vector
setwd_to_active_doc

Set working directory to active document in RStudio
tau_squared

Tau-squared (between-studies variance for meta analysis)
su

su: Sorted unique values
setup_r_env

Set up R environment
t_test_pairwise

t-tests, pairwise
robust_regression

Robust regression (bootstrapped regression)
se_of_proportion

Standard Error (SE) of a proportion
und

Undocumented functions
print_loop_progress

print loop progress
scatterplot

Scatterplot
unload_user_installed_pkgs

Unload all user-installed packages
pretty_round_r

Pretty round r
tv

Tabulate vector
standardize

Standardize
spotlight_2_by_continuous

Spotlight 2 by Continuous
var_of_percentage

Variance of a percentage
weighted_mean_effect_size

Estimate the mean effect size in a meta analysis
vlookup

Vlookup
round_flexibly

Round flexibly
wilcoxon_rank_sum_test

Wilcoxon Rank-Sum Test (Also called the Mann-Whitney U Test)
write_csv

Write to a csv file
rel_value_of_pos_in_vector

Find relative value of a position in a vector
two_way_anova

Two-Way Factorial ANOVA
z_to_r_transform

Z to r transformation (Inverse of Fisher's Z transformation)
simple_slopes_analysis

Simple slopes analysis
start_kim

Start kim
update_kim

Update the package 'kim'
remove_from_vector

Remove from a vector
simple_effects_analysis

Simple Effects Analysis
var_of_proportion

Variance of a proportion
weighted_z

Weighted z
weighted_mean_r

Weighted mean correlation
standardized_regression

Standardized Regression
var_of_log_odds_ratio_to_var_of_d

Convert variance of log odds ratio to variance of d
z_score

z score
bracket

Draw a bracket on a ggplot
akaike_weights

Akaike Weights
barplot_for_counts

Barplot for counts
check_req_pkg

Check for required packages
chi_squared_test

Chi-squared test
binomial_test

Binomial test
assign_fn_parameters_as_vars

Assign function parameters as values
capitalize

Capitalize a substring
clean_data_from_qualtrics

Clean data from Qualtrics
cohen_d_borenstein

Calculate Cohen's d as illustrated by Borenstein et al. (2009, ISBN: 978-0-470-05724-7)
cohen_d

Calculate Cohen's d and its confidence interval using the package 'psych'
cohen_d_over_n

Cohen's d as a function of sample size
change_var_names

Change variable names in a data set
check_modes

Check modes of objects