0

I have data from an experiment, where participants have been working in pairs, and they have to rate their enjoyment after the 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 would like to plot each participant enjoyment score, but I would like to have each participant within a pair on different axis (position 1 enjoyment on x-axis and position 2 enjoyment on y-axis).

Any suggestions as to how I might do that?

Follow up for the pro's: How do I plot the highest score within a pair on the y-axis?

Thank you.

1 Answers1

0

I don't have enough privileges for comments, so here it goes:

I don't really understand what this means:

(position 1 enjoyment on x-axis and position 2 enjoyment on y-axis)

Wouldn't you need two dimensions regardless? A only one-axis solution would just be dots along the axis line, it seems. If you could clarify that in your question (perhaps with a visual aid), that would be much more helpful.

As for some code attempting to answer the question:

plot(Pair ~ Enjoyment)

Would position the pairs on the y-axis and their enjoyment on the x-axis, so you could see the difference between enjoyments (or in the case where only one dot is present, the fact that the enjoyment was similar).

If you want to add some type of labels in order to make it clearer (with base R):

plot(Pair ~ Enjoyment, ylab="Pair", xlab="Enjoyment")
text(Enjoyment, Pair, labels=Position,pos=3)

If you find the overlapping labels unpalatable (as for pairs 8 and 10 in your example), here is a thread where that could be dealt with.

Is this is not what you asked for, and you instead mean something more complicated, the package 'scatterplot3d' could give you something that more closely resembles your description, but given the fact that the lengths of your variables differ (Position, Pair and Enjoyment), you would have to do some kind of transformation.

Community
  • 1
  • 1
erasmortg
  • 3,246
  • 1
  • 17
  • 34
  • Thank you for your suggestion. That is not quite what I am looking for though. The thing i would like to plot, is enjoyment for the player that has position 1 on the x-axis and ejoyment for the player that has position 2 on the y axis. – Marc Andersen Jun 01 '15 at 13:52
  • Coud you please add some visual aid for your plot? I cannot picture it – erasmortg Jun 01 '15 at 14:36