[R] Reordering levels of a factor within a lattice dotplot

Rui Barradas ruipbarradas at sapo.pt
Fri Jun 22 17:43:51 CEST 2012


Hello,

Ok, I hadn't understood. I still don't, not completely. Why do you want 
to order 'sample' with reference to 'obs'? It would make sense only in 
the case of 'obs' ties. Doesn't it make more sense to order 'sample' 
within 'site'?

As for keeping 'sample' character it's very simple, I was just trying to 
not using facotrs for it. The line that makes of it a Date should change to

myex$sample <- as.character(as.Date(myex$sample, format="%d/%m/%Y"))


Then, to order, within 'site' use

# first attempt, (Rui's 2nd)
ord <- with(myex, order(site, sample))

And if you now plot it, you'll see the samples ordered and a better y 
axis labels placing.

Rui Barradas

Em 22-06-2012 16:02, maxbre escreveu:
> thanks for your reply but I don't think your solution can accomplish to what
> I need...
> (I can't see any ordering of the variable "sample" with reference to the
> variable "obs")
>
> please keep in mind that for a numer of reasons that I do not mention here
> for the sake of conciseness in my case the variable "sample" must be
> espressed as a charachter (because what I proposed here is a simplification
> of the original variable composed by a concatenation of more information
> strings than the sampling date itself)
>
> and finally the labels on y axis are still not correctly disposed : same
> problem as in my example (also this feature must be properly sorted out)
>
>
> I think it's necessary to stick on the reordering of varibles but I can't
> figure how jet...
>
> m
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Reordering-levels-of-a-factor-within-a-lattice-dotplot-tp4634201p4634220.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list