LukasWallrich / timesaveR

R package to quickly perform data analysis and reporting tasks that might otherwise be time intensive
https://lukaswallrich.github.io/timesaveR
GNU General Public License v3.0
4 stars 1 forks source link

Harmonise argument names #11

Open LukasWallrich opened 1 month ago

LukasWallrich commented 1 month ago

Before submitting this to CRAN, argument names should be cleaned up. Particularly, the data argument should always be called data (unless a single vector, then x), and always come first. Also, same argument in related functions should have the same name (items vs scale_items in make_scale(s).

Below the status quo:

Folder Function Arguments
R/cat_desc_table.R .add_css code, class, add
R/cat_desc_table.R report_cat_vars data, dv, ..., var_names, level_names, p_adjust, alpha_level, filename, notes, dv_name, bold_vars, apa_style, css_tags, na.rm, exclude_na
R/cor_tables.R .wtd_cor_test_lm x, y, wt, ...
R/cor_tables.R cor_matrix data, var_names, missing, conf_level, method, adjust, bootstrap, seed
R/cor_tables.R cor_matrix_mi data, weights, var_names
R/cor_tables.R gt_add_plots gt_table, plots, col_index
R/cor_tables.R plot_distributions data, var_names, plot_type, hist_align_y, plot_theme
R/cor_tables.R report_cor_table cor_matrix, ci, n, add_distributions, data, filename, notes, stars, add_title, extras, apa_style, ...
R/cor_tables.R svy_cor_matrix svy_data, var_names, return_n
R/cor_tables.R tidy.cor_matrix x, both_directions, ...
R/cor_tables.R tidy.svy_cor_matrix x, both_directions, ...
R/cor_tables.R wtd_cor_matrix_mi mi_list, weights, var_names
R/formatters.R fmt_ci lower, upper, digits, drop_0
R/formatters.R fmt_cor cor_value, digits
R/formatters.R fmt_p p_value, digits, equal_sign
R/formatters.R fmt_pct x, digits
R/formatters.R round_ x, digits
R/formatters.R round_df df, digits
R/make_scales.R .cronbach_boot list_compl_data, boot
R/make_scales.R .scale_formula items
R/make_scales.R make_scale data, scale_items, scale_name, reverse, reverse_items, two_items_reliability, r_key, proration_cutoff, print_hist, print_desc, return_list, harmonize_ranges
R/make_scales.R make_scale_mi data, scale_items, scale_name, proration_cutoff, seed, alpha_ci, boot, parallel, ...
R/make_scales.R make_scales data, items, reversed, two_items_reliability, print_desc, ...
R/make_scales.R pool_estimates x, ci
R/make_scales.R range_ x, digits, simplify
R/make_scales.R spearman_brown data, items, name, SB_only
R/make_scales.R svy_make_scale data, scale_items, scale_name, print_hist, print_desc, scale_title, reversed, r_key
R/med_mod_code.R run_mediation data, X, Y, Ms, CVs, standardized_all, conf_level, seed, bootstraps, ...
R/med_mod_plots.R .grViz_and_save code, filename
R/med_mod_plots.R plot_mediation IV, DV, Ms, data, digits, coef_offset, filename, ind_p_values
R/med_mod_plots.R plot_moderated_mediation X, M, W, Y, CV, mod_direct_path, labels, filename
R/misc.R .floor_ceiling x, i
R/misc.R .is.numeric_col col, data
R/misc.R .make_stars_note stars, markdown
R/misc.R .pad x, len, padding
R/misc.R .unescape_html str
R/misc.R add_class x, class_to_add
R/misc.R clip_excel data, row_names, col_names, ...
R/misc.R cut_p x, p, ties.method, fct_levels, verbose
R/misc.R dump_to_clip objects
R/misc.R dupl_items x
R/misc.R get_coef_rename_tribble mod, show
R/misc.R get_rename_tribbles data, ..., show, which, max_levels
R/misc.R l2v x, strings, separators, to_clip, return
R/misc.R line_to_vector x, strings, separators, to_clip, return
R/misc.R na_ifs x, replace
R/misc.R na_share x, round
R/misc.R na_when x, ..., operator
R/misc.R named_list ...
R/misc.R paste_ ..., sep, collapse
R/misc.R rename_cat_variables data, var_names, level_names
R/misc.R rm_na x
R/misc.R run_and_format code
R/misc.R scale_blank x, center, scale
R/misc.R sigstars p, stars, pad_html, ns, return_NAs
R/misc.R to_tribble x, show, digits, to_clip
R/mod_tables.R .lm_F_test mod
R/mod_tables.R fmt_labels_md tab, position
R/mod_tables.R glance.mira x, adj_R2, ...
R/mod_tables.R gt_apa_style gt_table, fmt_labels_md
R/mod_tables.R mira.lm_F_test mod, return_list
R/mod_tables.R report_lm_with_std mod, mod_std, conf_level, coef_renames, fmt, statistic_vertical, filename, model_names, show_nimp, R2_change, notes, apa_style, stars, ...
R/mod_tables.R report_polr_with_std mod, mod_std, OR, conf_level, fmt, statistic_vertical, filename, model_names, show_nimp, notes, apa_style, stars, ...
R/mod_tables.R tidy_custom.polr x, ...
R/mod_tables.R tidy.mira x, conf.int, conf.level, ...
R/mod_tables.R tidy.tsR_std x, ...
R/pcor.R pcor_matrix data, given, ...
R/project_management.R add_package_snippets
R/project_management.R ggsave_show filename, ..., device, units
R/project_management.R rproj_to_clip
R/project_management.R setup_analysis_project folder, analyses, pipeline_name, code_folder, standard_packages, github_packages
R/report_stats.R report_anova x
R/stat_tests.R .clean_names x
R/stat_tests.R .run_t_test_mi mi_list
R/stat_tests.R .wtd_t_test_lm dv, g, wt, ...
R/stat_tests.R dummy_code x, prefix, drop_first, verbose
R/stat_tests.R get_pairwise_letters tests, alpha_level, p.adjust.method
R/stat_tests.R lm_std formula, data, weights, ...
R/stat_tests.R paired_t_test_d data, x, y
R/stat_tests.R pairwise_t_test_mi mi_list, dv, groups, weights, p.adjust.method
R/stat_tests.R pairwise_t_tests data, outcome, groups, p.adjust.method, conf_level, var_equal
R/stat_tests.R polr_std formula, data, weights, ...
R/stat_tests.R svy_cohen_d_pair data, dv, iv, pair, ttest, print
R/stat_tests.R svy_pairwise_t_test data, dv, iv, cats, p.adjust, ...
R/stat_tests.R t_test_mi mi_list, dv, groups, weights
R/svy_helpers.R svy_miss_var_summary svy_data, ..., .any_missing, .include_complete
R/timesaveR.R .check_req_packages x, note
R/timesaveR.R .onAttach libname, pkgname
R/timesaveR.R knit_print.timesaveR_raw_html x, ...
R/timesaveR.R print.timesaveR_raw_html x, ...
LukasWallrich commented 1 month ago

As part of that, add type checks where appropriate, and reconsider some functions (e.g., why only have paired_t_test_d rather than a wrapped for the full t.test function?