Page 1 of 1

Copy value inside column based on another column (ID)

Posted: Mon Feb 14, 2022 10:59 am
by Philipp.B
Hey everyone,

I can't figure out how to make it work. Some people asked similar questions in r-forums but it seems my understanding is to basic to make the transfer.
I have a large repeated measures dataset in long format and i performed a cluster-analysis. Now I need to copy the value signalling group-membership inside the second column based on Participant-ID.
See attachement for clarification. Left side of the picture is the current state, right side is what i hope to achieve.

Thank you in advance,
Philipp

Re: Copy value inside column based on another column (ID)

Posted: Mon Feb 14, 2022 6:43 pm
by MAgojam
Hey @Philipp.B,
if things are like in your attachment I suggest you use transform on the Cluster variable to get a new one (e.g. Cluster_new) with what you need.
How to do?
Take a look at the screenshot attached, it's a small example that I hope will help you.
screenshot.PNG
screenshot.PNG (47.11 KiB) Viewed 2609 times
Cheers,
Maurizio

Re: Copy value inside column based on another column (ID)

Posted: Thu Feb 17, 2022 6:21 pm
by Philipp.B
Hey Maurizio,

thank you for the fast and also very easy solution. I tried it in a small example dataset and it does exactly what I need. However, the actual dataset seems to be too much to handle as jamovi stops computing after five minutes and simply deletes my transformation. @jonathon: Any ideas?

Edit some hours later: The simple and obvious solution was to decrease the amount as much as possible. Now it still takes some minutes but works out in the end.

Re: Copy value inside column based on another column (ID)

Posted: Fri Feb 18, 2022 4:53 am
by jonathon
oh yup. the VMODE() is an expensive operation, and it's probably being computed separately for every row in the data set. i should see if there's a way i can optimise this a bit more.

one potential optimisation you could do would be to calculate the VMODE separately in it's own column, and then refer to that.

cheers

jonathon