[R] convert 'list' to 'vector'?

Liviu Andronic landronimirc at gmail.com
Wed Aug 10 21:58:46 CEST 2011


On Wed, Aug 10, 2011 at 9:32 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>> Thanks all! This is perfect, and very R-ish: never where a novice
>> would expect it to be.
>
> Well, since `unlist` is linked in the See Also on the help page for `list`,
> I can only hope you meant that in complete jest.
>
More or less. I would have expected that to transform a 'list' into a
'vector' I should look into 'as.vector' (or its See Also), and I would
have never guessed to look for 'unlist'.

R documentation is sometimes (often?) hard to parse, and when learning
R more often than not you're looking in the wrong place. But yes, it
was intended as humour (although I did expect to get grilled).


> As the Posting Guide says: "... sometimes `read the manual' is the
> appropriate response".
>
I did, but I was on the wrong track. It actually hasn't occurred to me
to check ?list, but See Also in both ?as.vector and ?simplify2array
does not link to 'unlist'. Since these are the two places where I
turned to in the first place, and I have also played extensively with
sapply(..., simplify=...) arguments, and there was nothing obvious in
their respective See Also, I figured that I did my homework reasonably
well.

Regards
Liviu



More information about the R-help mailing list