Copy value inside column based on another column (ID)

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
Philipp.B
Posts: 7
Joined: Fri Sep 24, 2021 9:57 pm

Copy value inside column based on another column (ID)

Post 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
Attachments
Copy values inside column based on id.PNG
Copy values inside column based on id.PNG (4.87 KiB) Viewed 853 times
User avatar
MAgojam
Posts: 422
Joined: Thu Jun 08, 2017 2:33 pm
Location: Parma (Italy)

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

Post 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 833 times
Cheers,
Maurizio
Philipp.B
Posts: 7
Joined: Fri Sep 24, 2021 9:57 pm

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

Post 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.
User avatar
jonathon
Posts: 2627
Joined: Fri Jan 27, 2017 10:04 am

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

Post 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
Post Reply