[R] Plot, lines and disordered x and y
Carl Witthoft
carl at witthoft.com
Fri Jan 23 22:08:48 CET 2009
Todor Kondic <dolichenus <at> gmail.com> writes:
> This is of course minor (actually asymptotically, no annoyance at
> all). I am just mentioning it for 'completness' sake and because a
> divinely ideal plotting function should cope with data given in any
> order.
>
It's not just a question of 'how many divine orders' there are, as
others have pointed out.
The fact is: if you define a vector, you have defined the order of the
components in the vector. if
x<-c(1,-1,2,-2,....) then x[1] is 1 and x[2] is 2.
That is the way every software program, and every statistician,
mathematician, and scientist agrees to define vectors.
If you want your data to be in a different order, there is no magical
'mind-reading' tool that can order it the way you are thinking of. You
have to load values into your vectors (or matrices, or whatever) in the
proper established order.
I can understand your frustration, because we've all seen datasets where
it would be useful and/or instructive to plot a visually-obvious subset
of the data. It just takes a little work on each of our part to
re-order, or sort, or extract, the points of interest into new vectors.
Carl
More information about the R-help
mailing list