[R] [Rd] Semantics of sequences in R

Stefan Evert stefan.evert at uos.de
Mon Feb 23 13:10:50 CET 2009


>> can you please stop repeating this nonsense?  I don't think anybody
>> ever claimed that vectors can be considered list.
>
> yes, it is nonsense.  yes, there is one person who repeatedly made  
> this
> claim.  please read the archives; specifically, [1]. note this  
> statement:
>
> 	"Note that any vector can be considered to be a list."
>
> [1] https://stat.ethz.ch/pipermail/r-help/2009-February/186932.html
>

Sorry, I missed that one.  Unfortunately I haven't kept a copy of the  
posting I was referring to and I can't find a page that allows me to  
search the February archives.

> when you're talking about nonsense, please attribute it to the right  
> person.

Well, you _are_ repeating it, aren't you?  Since you are so pedantic  
about the semantics of programming languages, you certainly can't  
complain about that statement.

I take back everything I wrote after that on the matter. Sorry!

>> 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).
>
> not *all* lists are vectors;  pairlists are not, though they are  
> lists.

Didn't someone just say that it would probably be best to hide  
pairlists from users entirely?

> but
>
>    mode(unlist(a))
>    # "numeric"
>    class(unlist(a))
>    # integer

Well, yes, that was the solution, wasn't it?  Since a list is a  
vector, you have to unlist() it explicitly to turn it into a "plain"  
vector. Except that it flattens the list, which is an entirely  
different operation than a mere mode change.  So I don't really  
understand what that comment was supposed to mean.

>> 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.
>
> irrespectively of how exotic sorting lists of vectors can be in a  
> system
> for the manipulation of a comprehensive range of sorts of data,  
> having a
> procedure called 'sort.list' complain about being called on a list  
> is a
> sure source of confusion.

Only until you read ?sort, isn't it?

> how much is it likely that people will want to sort complex numbers  
> in a
> system where complex numbers are incomparable?

I can only say that I'm not likely to want that either, but obviously  
someone did so it was implemented (I am sure that one factor leading  
to their decision was that this method does not clash with an existing  
function).

Cheers,
Stefan



More information about the R-help mailing list