0

I have searched for the solution but probably I did not know how to search with the correct terms, please let me know if the question is duplicated.

I made a minimal sample of my question.

I have a dataset like this:

fakedata <- data.frame(
  participant = rep(1:10,4),
  stimulus = rep(c('A','B'), each = 10, 2),
  value1 = rep(c(runif(10,0,1),runif(10,0,1)),2),
  value2 = rep(c(runif(10,0,1),runif(10,0,1)),2)
)

A stimulus for the same participant always have same value1 and value2 I wanted to subset the dataset so that for every participant stimulus A and stimulus B only occur once (assume runif produces the same value as above):

fakedata <- data.frame(
  participant = rep(1:10,2),
  stimulus = rep(c('A','B'), each = 10),
  value1 = c(runif(10,0,1),runif(10,0,1)),
  value2 = c(runif(10,0,1),runif(10,0,1))
)

Thank you very much for answering this question.

Kenny
  • 361
  • 1
  • 8

0 Answers0