[R] graphics question
tlumley at u.washington.edu
Wed May 15 18:59:21 CEST 2002
On Wed, 15 May 2002, Paul Lemmens wrote:
> --On woensdag 15 mei 2002 8:59 -0700 Thomas Lumley
> <tlumley at u.washington.edu> wrote:
> > On Wed, 15 May 2002, Paul Lemmens wrote:
> >> The graph I'm looking for has on the y-axis the RT values (in ms), so
> >> this should range from 350 - 450. On the x-axis I want two ticks for
> >> each level (sc and oc) of the 'cat' factor. In the plot, three lines
> >> should be displayed, for each level of the factor 'loc', pref. including
> >> a legend.
> >> How do I do this???
> > Does example(interaction.plot) look like the sort of thing you want?
> Yes!! This goes a great ways into what I want. However, if I do:
> data <- c(390,416,406,396,421,415)
> psc <- gl(2,3, labels=c("samecat","othercat"))
> loc <- gl(3,2, labels=c("corresp", "noncorresp", "noninf"))
> interaction.plot(psc, loc, data)
> I get only one line (for noncorresp) which looks as if it is the average of
> all data points (2 times the average of 3 points). This makes sense because
> of the fun argument of interaction.plot (which, to me, seems to default to
> mean). Can I override this with some function that just returns one point
> of data??
The problem is with your definition of psc and loc. You haven't defined
them the way you think you have:
data psc loc
1 390 samecat corresp
2 416 samecat corresp
3 406 samecat noncorresp
4 396 othercat noncorresp
5 421 othercat noninf
6 415 othercat noninf
You need something like
loc <- factor(rep(1:3,2), labels=c("corresp", "noncorresp", "noninf"))
and then it works
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help