kleinbub / rMEA

an R package to perform synchronization analysis on motion energy time-series
GNU General Public License v3.0
15 stars 2 forks source link

feature request: Shuffle combinations: recombine values of s1 and s2 without also combining different s1 with s1 and s2 with s2 #5

Closed thekryz closed 3 years ago

thekryz commented 3 years ago

I have a case in which I would like to shuffle data (to evaluate pseudosynchrony) by only recombining s1 time-series with s2 time-series, since series for s1 and s2 differ intrinsically. However, when using the shuffle function, I also end up with recombinations of s1 with s1 and s2 with s2 respectively, which I would like to avoid. For example, if my s1 time series are the therapist values and s2 are the patient values, I'd only want to recombine therapists and patients, not patients with patients or therapists with therapists. Unless I'm doing something wrong, this seems to be standard in the shuffle function. So right now, I have to sort these combinations out post-shuffling, but I'd love an option to limit recombinations this way in the shuffle function, maybe something along the lines of

shuffle(myMEAs, size=5000, combineSameRoles=FALSE)

Standard could of course be TRUE to assure backward compatibility.

Thank you for considering my request!

kleinbub commented 3 years ago

implemented in v1.2.2 the argument is called keepRoles, and the default is FALSE please test it and let me know if there's any issue