Learn R Programming

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

kim: Behavioral Scientists’ Analysis Toolkit

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
two_way_anova(
  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.5.3

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Jin Kim

Last Published

March 18th, 2022

Functions in kim (0.5.3)

coefficent_of_variation

Coefficient of variation
clean_data_from_qualtrics

Clean data from Qualtrics
check_req_pkg

Check for required packages
chi_squared_test_pairwise

Chi-squared test, pairwise
cohen_d_borenstein

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

Cohen's d as a function of sample size
cohen_d

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

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

Change variable names in a data set
capitalize

Capitalize a substring
cohen_d_torchiano

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

Convert a comma-separated string of numbers
combine_data_across_cols

Combine data across columns
compare_datasets

Compare data sets
bracket

Draw a bracket on a ggplot
convert_to_excel_formula

Convert character to Excel formula
convert_cols_to_numeric

Convert columns to numeric
forest_plot

Forest plot
ggsave_quick

ggsave quick
histogram

Histogram
find_duplicates

Find duplicated values in a vector
exit_from_parent_function

Exit from a Parent Function
histogram_by_group

Histogram by group
compare_dependent_rs

Compare dependent correlations
matrix_prep_dt

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

Compare effect sizes
mediation_analysis

Mediation analysis
logistic_regression_table

Logistic regression table
compare_groups

Compare groups
multiple_regression

Multiple regression
desc_stats

Descriptive statistics
compare_independent_rs

Compare independent correlations
read_csv

Read a csv file
repeated_measures_anova

Repeated-Measures ANVOA
start_kim

Start kim
q_stat_test_homo_r

Q statistic for testing homogeneity of correlations
replace_values_in_dt

Replace values in a data table
desc_stats_by_group

Descriptive statistics by group
plot_group_means

Plot group means
pm

Paste for message
noncentrality_parameter

Find noncentrality parameter
histogram_w_outlier_bins

Histogram with outlier bins
su

su: Sorted unique values
detach_user_installed_pkgs

Detach all user-installed packages
install_all_dependencies

Install all dependencies for all functions
kurtosis

Kurtosis
duplicated_values

Duplicated values in a vector
logistic_reg_w_interaction

Logistic regression with an interaction term
id_across_datasets

ID across datasets
mann_whitney

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

Standard error of the mean
regex_match

Regular expression matches
setup_r_env

Set up R environment
weighted_mean_r

Weighted mean correlation
read_sole_csv

Read the sole csv file in the working directory
t_test_pairwise

t test, pairwise
tabulate_vector

Tabulate vector
percentile_rank

Percentile rank
logistic_regression

Logistic regression
p0

Paste0
parallel_analysis

Parallel analysis
merge_data_tables

Merge data tables
remove_user_installed_pkgs

Remove all user installed packages
prep

Prepare package(s) for use
top_median_or_bottom

Top, median, or bottom
theme_kim

Theme Kim
merge_data_table_list

Merge a list of data tables
remove_from_vector

Remove from a vector
population_variance

Population variance of a vector
print_loop_progress

print loop progress
proportion_of_values_in_vector

Proportion of given values in a vector
correlation_matrix

correlation matrix
round_flexibly

Round flexibly
write_csv

Write to a csv file
robust_regression

Robust regression (bootstrapped regression)
wilcoxon_rank_sum_test

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

Find relative value of a position in a vector
pivot_table

Pivot Table
simple_effects_analysis

Simple Effects Analysis
rel_pos_of_value_in_vector

Find relative position of a value in a vector
setwd_to_active_doc

Set working directory to active document in RStudio
cum_percent_plot

Cumulative percentage plot
update_kim

Update the package 'kim'
weighted_z

Weighted z
und

Undocumented functions
unload_user_installed_pkgs

Unload all user-installed packages
fisher_z_transform

Fisher's Z transformation
outlier

Outlier
floodlight_2_by_continuous

Floodlight 2 by Continuous
order_rows_specifically_in_dt

Order rows specifically in a data table
pretty_round_p_value

Pretty round p-value
vlookup

Vlookup
pretty_round_r

Pretty round r
score_scale_items

Score scale items
scatterplot

Scatterplot
skewness

Skewness
spotlight_2_by_continuous

Spotlight 2 by Continuous
two_way_anova

Two-way ANOVA
z_to_r_transform

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

Tabulate vector
barplot_for_counts

Barplot for counts