Plotting participants within a pair on individual axis' in R? -
i have data experiment, participants have been working in pairs, , have rate enjoyment after task.
participant<-(c(1:20)) pair<-(c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10)) position<-(c(1:2)) enjoyment<-(c(2,6,8,4,5,6,2,3,9,8,6,5,3,2,6,6,6,7,8,8)) data<-data.frame(participant, pair, position, enjoyment)
i plot each participant enjoyment score, have each participant within pair on different axis (position 1 enjoyment on x-axis , position 2 enjoyment on y-axis).
any suggestions how might that?
follow pro's: how plot highest score within pair on y-axis?
thank you.
i don't have enough privileges comments, here goes:
i don't understand means:
(position 1 enjoyment on x-axis , position 2 enjoyment on y-axis)
wouldn't need 2 dimensions regardless? one-axis solution dots along axis line, seems. if clarify in question (perhaps visual aid), more helpful.
as code attempting answer question:
plot(pair ~ enjoyment)
would position pairs on y-axis , enjoyment on x-axis, see difference between enjoyments (or in case 1 dot present, fact enjoyment similar).
if want add type of labels in order make clearer (with base r):
plot(pair ~ enjoyment, ylab="pair", xlab="enjoyment") text(enjoyment, pair, labels=position,pos=3)
if find overlapping labels unpalatable (as pairs 8 , 10 in example), here thread dealt with.
is not asked for, , instead mean more complicated, package 'scatterplot3d' give more closely resembles description, given fact lengths of variables differ (position, pair , enjoyment), have kind of transformation.
Comments
Post a Comment