[R] 2 plots sharing axis / combining factors

juli g. pausas juli at ceam.es
Mon Sep 30 17:22:32 CEST 2002


Dear R users,

- Is it possible to produce a figure with 2 plots that they share one of
the axis, e.g., the y-axis?
I did not succeed by setting mai[4] <- 0. Is there a simple way?

- How could I convert 2 factor variables in a single factor variable
which is the combination of the other 2.
Example:
    lith: a factor 2 levels "ca", "ma"
    sp: a factor with 2 levels, "ph", "qi"
and I'd like to obtain:
    splith: a factor with 4 levels: phma, phca, qima, qica

on way is by using ifelse:

splith <- as.factor(ifelse(sp=="ph", ifelse(lith=="ma", "phma", "phca"),
ifelse(lith=="ma", "qima", "qica")))

which works fine, but I've got the feeling that it can be done in a more
efficient way, especially for other cases where factors have more than 2
levels.


Thanks in advance for any suggestion

Juli

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list