Learn R Programming

⚠️There's a newer version (0.6.1) of this package.Take me there.

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

315

Version

0.5.431

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jin Kim

Last Published

October 1st, 2024

Functions in kim (0.5.431)

compare_groups

Compare groups
comma_sep_string_to_numbers

Convert a comma-separated string of numbers
compare_datasets

Compare data sets
compare_independent_rs

Compare independent correlations
exit_from_parent_function

Exit from a Parent Function
excel_formula_convert

Excel formula, convert (to)
cohen_d_to_r

Convert Cohen's d to r
cohen_d_over_n

Cohen's d as a function of sample size
combine_data_across_cols

Combine data across columns
cohen_d_torchiano

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

Descriptive statistics by group
desc_stats

Descriptive statistics
compare_dependent_rs

Compare dependent correlations
correlation_matrix

correlation matrix
clean_data_from_qualtrics

Clean data from Qualtrics
coefficent_of_variation

Coefficient of variation
assign_fn_parameters_as_vars

Assign function parameters as values
cum_percent_plot

Cumulative percentage plot
fisher_z_transform

Fisher's Z transformation
floodlight_for_contrasts

Floodlight Analyses for a Set of Contrasts
floodlight_multi_by_continuous

Floodlight Multicategorical by Continuous
floodlight_2_by_continuous

Floodlight 2 by Continuous
floodlight_2_by_continuous_logistic

Floodlight 2 by Continuous for a Logistic Regression
cohen_d_for_one_sample

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

Histogram
histogram_by_group

Histogram by group
convert_to_excel_formula

Convert character to Excel formula
compare_effect_sizes

Compare effect sizes
cohen_d_from_cohen_textbook

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

Contingency table
holm_adjusted_p

Holm-adjusted p-values
id_across_datasets

ID across datasets
log_odds_ratio

Log odds ratio
levene_test

Levene's test
factorial_anova_2_way

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

Find duplicated values in a vector
floodlight_2_by_continuous_mlm_logistic

Floodlight 2 by Continuous for a Multilevel Logistic Regression
identical_all

Check whether all inputs are identical
correlation_kim

Estimate the correlation between two variables
histogram

Histogram
ggsave_quick

ggsave quick
loglinear_analysis

Loglinear analysis
logistic_regression_table

Logistic regression table
logistic_regression

Logistic regression
convert_cols_to_numeric

Convert columns to numeric
detach_user_installed_pkgs

Detach all user-installed packages
p0

Paste0
merge_data_table_list

Merge a list of data tables
lenu

lenu: Length of unique values
kurtosis

Kurtosis
merge_data_tables

Merge data tables
mad_remove_outliers

Remove outliers using the MAD method
mean_center

Mean center
mediation_analysis

Mediation analysis
forest_plot

Forest plot
histogram_from_hist

Histogram from hist function
duplicated_values

Duplicated values in a vector
geomean

Geometric mean
histogram_w_outlier_bins

Histogram with outlier bins
pm

Paste for message
population_variance

Population variance of a vector
parallel_analysis

Parallel analysis
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
outlier

Outlier
install_all_dependencies

Install all dependencies for all functions
mann_whitney

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

Multiple regression
log_odds_ratio_to_d

Convert log odds ratio to Cohen's d
overlapping_interval

Find the overlapping interval of two ranges.
round_flexibly

Round flexibly
rel_value_of_pos_in_vector

Find relative value of a position in a vector
score_scale_items

Score scale items
remove_from_vector

Remove from a vector
package_list_default

Packages - List the default packages
mixed_anova_2_way

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

Scatterplot
se_of_mean

Standard error of the mean
noncentrality_parameter

Find noncentrality parameter
pretty_round_r

Pretty round r
print_loop_progress

print loop progress
read_csv

Read a csv file
percentile_rank

Percentile rank
read_sole_csv

Read the sole csv file in the working directory
simple_effects_analysis

Simple Effects Analysis
pivot_table

Pivot Table
plot_group_means

Plot group means
odds_ratio

Odds ratio
simple_slopes_analysis

Simple slopes analysis
su

su: Sorted unique values
modes_of_objects

Find modes of objects
replace_values_in_dt

Replace values in a data table
robust_regression

Robust regression (bootstrapped regression)
prep

Prepare package(s) for use
var_of_log_odds_ratio_to_var_of_d

Convert variance of log odds ratio to variance of d
t_test_pairwise

t-tests, pairwise
update_kim

Update the package 'kim'
se_of_percentage

Standard Error (SE) of a percentage
order_rows_specifically_in_dt

Order rows specifically in a data table
se_of_proportion

Standard Error (SE) of a proportion
pretty_round_p_value

Pretty round p-value
setup_r_env

Set up R environment
simple_slopes_analysis_logistic

Simple slopes analysis with logistic regression analyses
tabulate_vector

Tabulate vector
remove_user_installed_pkgs

Remove all user installed packages
skewness

Skewness
tau_squared

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

Repeated-Measures ANVOA
spotlight_2_by_continuous

Spotlight 2 by Continuous
standardize

Standardize
proportion_of_values_in_vector

Proportion of given values in a vector
theme_kim

Theme Kim
setwd_to_active_doc

Set working directory to active document in RStudio
top_median_or_bottom

Top, median, or bottom
und

Undocumented functions
q_stat_test_homo_r

Q statistic for testing homogeneity of correlations
tv

Tabulate vector
two_way_anova

Two-Way Factorial ANOVA
regex_match

Regular expression matches
wilcoxon_rank_sum_test

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

Unload all user-installed packages
write_csv

Write to a csv file
rel_pos_of_value_in_vector

Find relative position of a value in a vector
standardized_regression

Standardized Regression
z_score

z score
var_of_percentage

Variance of a percentage
var_of_proportion

Variance of a proportion
z_to_r_transform

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

Start kim
weighted_mean_r

Weighted mean correlation
vlookup

Vlookup
weighted_mean_effect_size

Estimate the mean effect size in a meta analysis
weighted_z

Weighted z
capitalize

Capitalize a substring
akaike_weights

Akaike Weights
check_modes

Check modes of objects
check_req_pkg

Check for required packages
barplot_for_counts

Barplot for counts
bracket

Draw a bracket on a ggplot
change_var_names

Change variable names in a data set
binomial_test

Binomial test
chi_squared_test

Chi-squared test
cohen_d

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

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

Chi-squared test, pairwise
ci_of_mean

Confidence Interval of the Mean of a Vector