KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I wish to plot mean (or other function) of reaction time as a function of the location of the target in the x y plane. As test data: library(ggplot2) xs <- runif(100,-1,1) ys <- runif(100,-1,1) rts <- rnorm(100) testDF <- data.frame("x"=xs,"y"=ys,"rt"=rts) I know I can do this: p <- ggplot(data = testDF,aes(x=x,y=y))+geom_bin2d(bins=10) What I would like to be able to do, is the same thing but plot a function of the data in each bin rather than counts. Can I do this? Or do I need to generate the conditional means first in R (e.g. drt <- tapply(testDF$rt,list(cut(testDF$x,10),cut(testDF$y,10)),mean) ) and then plot that? Thank you.
Tags (comma-separated)
Save Edits
Cancel