[R] R help: reorder columns in an xyplot
Michael Rentz
rent0009 at umn.edu
Mon Nov 8 06:28:24 CET 2010
Mr. Dunlap and Dr. Winsemius:
Thank you both for your very quick, very handy, and very correct response.
That was it. I only wish I had broken down and admitted defeat and asked
for help hours ago.
That was indeed what I needed, now the before does indeed come before the
after!
Thanks again,
Mike.
On Nov 7 2010, David Winsemius wrote:
>
>On Nov 7, 2010, at 10:35 PM, rent0009 at umn.edu wrote:
>
>> Hello. First post, though I have read scores. Mostly i can solve my
>> problems reading the archives, but I lack the vocabulary to ask this
>> one right. Any social faux pais, I apologize.
>>
>> I am sure this is a very basic question and I am embarrassed to ask,
>> but I spent several hours scouring the archives and trying various
>> suggestions, but I am too new to get any of them to work.
>>
>> I am trying to generate an xyplot (or bwplot) for a presentation on
>> Tuesday. As part of my dissertation I have 3 treatments divided into
>> 2 time periods (before and after treatment).
>>
>> Code that works (stripped of labels) is:
>>
>> xyplot(veg$litter_depth ~ veg$status | veg$treatment, layout=c(3,1),
>> type=c("p","r"))
>>
>> Status is "before" and "after" In essence I am plotting a change in
>> litter depth (and about 50 other variables) over time for each of
>> the treatments. This generates a graph with 3 separate plots, one
>> for each treatment. The plot works, but after is on the left and
>> before on the right. This bugs me.
>>
>> I tried:
>> veg$status2 <- reorder(veg$status, new.order=
>> but get:
>> Error in length(X) : 'X' is missing
>
>To make this leass ambiguous you could have posted str(veg). Try
>(perhaps):
>
>veg$status <- factor(vec$status, levels=c(c("before", "after"))
>
>Then plot as before.
>
>
--
Michael S. Rentz
PhD Candidate, Conservation Biology
University of Minnesota
rent0009 at umn.edu
More information about the R-help
mailing list