Skip to content

Functionality: Allow users to specify which summary stats to use in the codebook - #129

Open
jikac wants to merge 2 commits into
cjvanlissa:masterfrom
jikac:master
Open

jikac wants to merge 2 commits into
cjvanlissa:masterfrom
jikac:master

Conversation

@jikac

@jikac jikac commented Mar 1, 2023

Copy link
Copy Markdown

Hi there,

I've added some code to the codebook.R file that allows users to specify a string of summary statistics that they would like to appear in the codebook. I've tested that it works well and have had no issues. I do ensure that "name" and "type" are always specified, but there might be a better way to handle that.

jikac added 2 commits March 1, 2023 16:30
Added an additional argument to make_codebook() called stats. If this argument is not called, then the codebook will generate all 18 variables as previously designed. If the user enters a string of stats (e.g., stats = "n missing mean median sd min max"), then the summary stats will be limited only to those but will also include the name and type of the variable.

The following stats may be specified: n, missing, unique, mean, median, mode, mode_value, sd, v, min, max, range, skew, skew_2se, kurt, kurt_2se
Fixed logic condition.
@cjvanlissa

cjvanlissa commented Mar 2, 2023

Copy link
Copy Markdown
Owner

Edit: Thank you for engaging with the package and suggesting this functionality!

However, I'm not sure about this.. can you clarify what problem this solves?

I do see potential for breaking other functionality; for example, the functionality to restore factor/ordered factor levels relies on the codebook; if this information is missing, that functionality would break.

@jikac

jikac commented Mar 2, 2023

Copy link
Copy Markdown
Author

No problem! In many cases, especially with specific kinds of data, there is no reason to list out the mode, mode_value, kurtosis, skewness, etc. This feature would allow the user to only specify what they want to show in the codebook. It provides a cleaner representation of the data.

Would you be willing to point me to the file you mention about factor/ordered factor levels? I have some ideas in mind to fix that if need be.

@cjvanlissa

Copy link
Copy Markdown
Owner

have a look here:

check_metadata <- function(x, codebook, value_labels){

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants