strengejacke / esc

Effect Size Computation for Meta Analysis
https://strengejacke.github.io/esc
20 stars 6 forks source link

Transforming effect size from a data frame #11

Open ChristCBA opened 1 year ago

ChristCBA commented 1 year ago

Hello Daniel,

I have a data frame of 127 studies with the mean and SD that I want to transform into Hedges' g. But now I am updating my R to version 4.3.1, and the function is not working. The code worked previously in version 4.2.0. This is the code I used:

transform = esc_mean_sd(grp1m = df$mean1, grp1sd = df$sd1, grp1n = df$n1, grp2m = df$m2, grp2sd = df$sd2, grp2n = df$n2, es.type = "g", study = df$author)

This is the error message: Error in missing(grp1sd) || is.null(grp1sd) || is.na(grp1sd) : 'length = 127' in coercion to 'logical(1)'

Do you have any suggestion on how to fix issue? Thank you.

YongZhiFoo commented 7 months ago

Hi Daniel,

I am having the same issue as well, having updated my R too.

I believe it has something to do with using && and || for the if() function, as discussed here: https://stackoverflow.com/questions/72848442/r-warning-lengthx-2-1-in-coercion-to-logical1/72848495#72848495

So it might be linked to this part of the code?

check if parameter are complete

if ((missing(totalsd) || is.null(totalsd) || anyNA(totalsd)) && ((missing(grp1sd) || is.null(grp1sd) || anyNA(grp1sd)) || (missing(grp2sd) || is.null(grp2sd) || anyNA(grp2sd)))) { warning("Either totalsd or both grp1sd and grp2sd must be specified and are not allowed to have missing values.", call. = FALSE) return(esc_generic(es = NA, v = NA, es.type = es.type, grp1n = NA, grp2n = NA, info = NA, study = NA)) }

Thanks for the help!