From stefan.evert at uos.de  Mon Feb 23 12:12:39 2009
From: stefan.evert at uos.de (Stefan Evert)
Date: Mon, 23 Feb 2009 12:12:39 +0100
Subject: [Rd] [R] Semantics of sequences in R
In-Reply-To: <49A27AF4.307@idi.ntnu.no>
References: <8b356f880902221242r47cdb138w9b1ac05cc5e5e317@mail.gmail.com>	<49A1BFC7.9060503@stats.uwo.ca>	<8b356f880902221350q4a976bfr19b0d5b01a989250@mail.gmail.com>	<20090223113422.76cc1494@absentia>	<49A255A5.1010506@idi.ntnu.no>
	<20090223175623.6106add2@berwin-nus1> <49A27AF4.307@idi.ntnu.no>
Message-ID: <91A643DD-EBED-4584-B0FD-2DA2025256FD@uos.de>

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 ]



[Rd] [R] Semantics of sequences in R
Stefan Evert