TransWikia.com

Automatic pseudo-randomization of stimuli in R

Psychology & Neuroscience Asked on April 20, 2021

I was wondering if it’s possible to automatically pseudo-randomize stimuli in R? If so, I would be very grateful for any help.

One Answer

You can use the "sample" function: https://stat.ethz.ch/R-manual/R-devel/library/base/html/sample.html

Start with a list of the stimuli you want to present. For example, if you have two stimuli that should be repeated 4 times each, your list would be c(1,1,1,1,2,2,2,2)

If you take 8 samples from this distribution without replacement, you have a random permutation of the list. This is the default behavior if you just give the original list, like this:

sample(c(1,1,1,1,2,2,2,2))

Answered by Bryan Krause on April 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP