[Rd] [R] Semantics of sequences in R
Stefan Evert
stefan.evert at uos.de
Mon Feb 23 12:12:39 CET 2009
Dear vQ,
> vectors (can-be-considered-lists),
can you please stop repeating this nonsense? I don't think anybody
ever claimed that vectors can be considered list. It's rather the
other way round: lists can also be seen as vectors to R (possibly they
are implemented as such, but I don't much about the internals of R).
> a <- as.list(1:10)
> b <- 1:10
> is.vector(a)
[1] TRUE
> is.list(a)
[1] TRUE
> is.vector(b)
[1] TRUE
> is.list(b)
[1] FALSE
Hence the confusion about
> mode(as.vector(a))
[1] "list"
which prompted the original comment that you are taking so much
exception to.
> as to "it could only work in very specific circumstances" -- no, it
> would work for any list whatsoever, provided the user has a correctly
> implemented comparator. for example, i'd like to sort a list of
> vectors
> by the vectors' length -- is this a very exotic idea?
Honestly, I can't think of a situation where I would want to do than
in R. In a Perl script, quite likely; but this is a kind of data
manipulation that R wasn't really designed for IMHO.
Not that I'd mind having sort() operate properly on lists; it just
isn't something I miss in the language.
Best,
Stefan
[ stefan.evert at uos.de | http://purl.org/stefan.evert ]
More information about the R-devel
mailing list