12/11/2023 0 Comments Tidyverse summarizeSummarise(ci = list(enframe(Hmisc::smean.cl. Hmisc::smean.cl.normal returns a named vector, rather than a data frame, so the code to get wide output is slightly different: test %>% You could also use the Hmisc functions directly. Summarise(ci = list(mean_cl_normal(mAP) %>% The filter removes rows that have multiple fields with the word Total. In janitor the totals normally come after the group that is totaled but we can use the name '0' in place of Total and sort so that the totals sort first and then at the end replace '0' with the word Total. Use mean_cl_boot instead of mean_cl_normal if you want bootstrapped confidence intervals instead of confidence limits that assume normality. 1) We can use adorntotals from the janitor package. Mean_cl_normal uses y, ymin, and ymax as the names for the mean and confidence limits, respectively, so I've also renamed them. Other than returning the upper and lower confidence limits with a single function call, Hmisc::smean.cl.normal is using the same method to calculate the confidence limits. If you want to use a function in a pre-existing package, you could use mean_cl_normal from ggplot2 ( mean_cl_normal is wrapper around Hmisc::smean.cl.normal()) as a quick way to achieve something similar. It seems like the code for your example should use the actual number of observations in each group as the "n" argument in the CI functions, rather than the n column in the data frame. In your example, n is a group identifier, but then you also use it as the number of observations. What do you think? Would you modify/improve something? Would you use a completely different approach altogether? Let me know! #> Warning in qt(1 - ((1 - conf_level)/2), n - 1): Si è prodotto un NaNĬreated on by the reprex package (v0.3.0)īut I've been away from R for a while, and I may have missed/forgotten better ways to do it. Summarise(smean = mean(mAP, na.rm = TRUE), #> The following objects are masked from 'package:base': tidyverse: append rows of totals in summary output Ask Question Asked 2 years, 1 month ago Modified 2 years, 1 month ago Viewed 585 times Part of R Language Collective 1 I want append rows of totals in the output of summarise used with groupby. #> The following objects are masked from 'package:stats':
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |