Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Applying a function across variables in JASP

In JASP I'd like to apply some standard functions across rows. For example, to get the mean of some scale items on a survey I could use the R code (Q1 + Q2 + Q3) / 3, but if any one of those is missing, the result would be missing. I'd like the result to be the mean of the non-missing values. I'd like to do this in general, so that I could get the median, sd, etc. Is this possible? Thanks!

Comments

  • Hi Bob,

    Thanks for the question. We’re working on the interface to make row manipulations in JASP more intuitive. To do what you’d like in the current version of JASP, we have to resort to the R interface in compute column. The R code is then 

    apply(data.frame(Q1, Q2, Q3), 1, mean, na.rm=TRUE)

    or 

    apply(data.frame(Q1, Q2, Q3), 1, sd, na.rm=TRUE)

    Hence, it is possible to do this in JASP, but it requires some knowledge of R syntax, which is not as user-friendly as we’d like. We hope to have the new data manipulation interface implemented soon. 

    Cheers,

    Alexander

Sign In or Register to comment.