[R] newbie: embeding seq in a list

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Oct 30 16:51:01 CET 2012

You first example is a list of 5 items, each item is a number
The second example is a list with one item: a vector with 5 elements.

You'll need c() to make a vector of the item to get the same result.
all.equal(list(c(0.8,0.9,1.0,1.1,1.2)), list(seq(0.8, 1.2, by = 1.1)))

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx at inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens Anser Chen
Verzonden: dinsdag 30 oktober 2012 13:42
Aan: r-help at r-project.org
Onderwerp: [R] newbie: embeding seq in a list

Suppose I want to create a structure containing the following values:

If I use

env <- list(0.8,0.9,1.0,1.1,1.2)

then R returns

> env
[1] 0.8

[1] 0.9

[1] 1

[1] 1.1

[1] 1.2

But, if I try to 'save some key-strokes', and use

env <- list(seq(0.8,1.2,by=0.1))

then R returns

> env
[1] 0.8 0.9 1.0 1.1 1.2

I'd like the 'latter' to be equivalent to 'the former', but can't figure out how to achieve said aim.

Thanks in advance...

        [[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.

More information about the R-help mailing list