0

I did a RCT and now I want to calculate a specific measure called ABV - somthing with participants attention, I want to calculat it among the last 45 trials (out of 200)so I split the data (using xl) and for some reason I get this error. The code works for all of the other data, the error is specific for that one table.. everything looks OK. I dont know what can I do (If I do it for all of the 200 trials, all the table, it works) Thank you!

#TEMP Data set creating running means for each person using rmean10 function

OUT1<-tapply(imp$Probe.RT.clean,list(imp$Subject,imp$ProbeBehind),rmean10)

Error in cx[1:(length(cx) - 10)] : 
  only 0's may be mixed with negative subscripts

I tried removing a specific paticipant who has long reaction time but that didnt help.

Andrew Gustar
  • 17,295
  • 1
  • 22
  • 32
Mai
  • 1
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Clearly list all non-base R packages you are using. – MrFlick Jul 24 '23 at 13:53
  • 3
    If you've written the `rmean10` function yourself, you need to tell it what to do if `length(cx)` is less than 11 - that is where the error seems to be coming from. – Andrew Gustar Jul 24 '23 at 14:15

0 Answers0