Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Fri Feb 20 22:26:07 CET 2009
Rolf Turner wrote:
> On 21/02/2009, at 12:54 AM, lauramorgana at bluewin.ch wrote:
>> Thank you for your advice, but I didn't manage to make it work...
>> I tried
>> carichi.annui <-
>> And I got this error message:
>> Error in data.frame(anno, loadPTG, loadPO4, loadNT, loadNH4, loadNO3, :
>> the arguments have a different numer of rows: 4, 1
>> If I do
>> sapply(carichi.annui, class)
>> I get:
>> anno loadPTG loadPO4 loadNT loadNH4 loadNO3 loadBOD5 loadSiO2
>> "list" "list" "list" "list" "list" "list" "list" "list"
>> I thought that the function as.vector() could turn a list of numbers
>> into a vector... was I wrong?
> Yes, you were wrong. E.g.:
> > u <- list(1,2,3)
> > v <- as.vector(u)
> > class(v)
>  "list"
> > all.equal(u,v)
>  TRUE
> Despite what some people (whose arrogance exceeds their wisdom) will
> try to tell you,
> vectors can be considered to be lists. At a certain level.
there should be no doubt this extremely polite *trolling* is targetted
at me. you're showing your class. or maybe mode?
go on, *tell* the user what 'vectors can be considered lists' means.
you haven't cared to do it before, now you have once-in-a-lifetime
chance to show your wisdom exceeding your arrogance. can you?
> If you want to turn an object of class "list" into a ``real'' vector
> (e.g. of class
> "numeric") use unlist():
... where 'real' is supposed to mean they're cannot-be-considered-list
vectors? always cool to see more evidence that you prefer rubbish lousy
talk to coherent terminology.
> > w <- unlist(v)
... to be sure, an unlisted vector is still a list. *rubbish*.
and the respective documentation (would you, rolf, care to quote any
when you make your claims?) for is.list and is.vector make it clear (to
some) that not all lists are vectors, and *not all vectors* are lists.
'a vector can be considered a list' is true, well, if and only if the
vector happens to be a list. unlist(v) is *not* a list. or please do
care to explain why it is. please do, rolf, and stop provoking me, it's
More information about the R-help