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

  • I am wondering if this function has been added. I am new to JASP and trying to understand how to compute a single mean from multiple columns (a scale). The R code gives me blank answer, I assume because there is a missing variable somewhere). Is there another way to do this?

  • Have you confirmed that your variables are not nominal? Maybe you could send along a small part of your data set (or some made up values) as a .jasp file so we can give it a go?

    E.J.

Sign In or Register to comment.