Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jikaczmarski
Copy link

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.

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
Copy link
Owner

cjvanlissa commented Mar 2, 2023

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.

@jikaczmarski
Copy link
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
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