Spotfire, TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Johannes Graumann
Sent: Wednesday, October 05, 2011 4:29 AM
To: r-h...@stat.math.ethz.ch
Subject: [R] Vector-subsetting with ZERO
Dear All,
I have trouble generizising some code.
index - 0
sapply(list(c(1,2,3),c(1,2),c(1)),function(x){x[max(length(x)-index,0)]})
Will yield a wished for vector like so:
[1] 3 2 1
But in this case (trying to select te second to last element in each vector
of the list)
index - 1
[mailto:r-help-boun...@r-project.org] On
Behalf Of Johannes
Graumann
Sent: Wednesday, October 05, 2011 4:29 AM
To: r-h...@stat.math.ethz.ch
Subject: [R] Vector-subsetting with ZERO - Is behavior changeable?
Dear All,
I have trouble generizising some code.
index - 0
sapply(list(c(1,2,3
3 matches
Mail list logo