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

fixing create_analysis_median #38

Conversation

yannsay-impact
Copy link
Collaborator

the function was calculating the mean instead of the median when a subset of the dataframe had only NAs. All values were the mean, instead of the median.

error was coming from the tryCatch that was not catching the correct error. The tryCatch was initially introduced to have the function run when only NA. It was now catching another error, i.e. when only subset has only missing value.

the function was calculating the mean instead of the median when a subset of the dataframe had only NAs. All values were the mean, instead of the median.

error was coming from the tryCatch that was not catching the correct error. The tryCatch was initially introduced to have the function run when only NA. It was now catching another error, i.e. when only subset has only missing value.
The default calculation from survey_median is to take the lower value when the median is between 2 value, e.g. c(1,2) will return 1.
create_analysis_median will take the mean of the value by default, i.e. 1.5

Updating version number as well
@yannsay-impact yannsay-impact merged commit d748f32 into impact-initiatives:main Nov 27, 2024
9 checks passed
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.

1 participant