[R] first value...
Daniel Malter
daniel at umd.edu
Tue Jun 23 16:10:00 CEST 2009
min(which(is.na(inc)==FALSE)) #index
inc[min(which(is.na(inc)==FALSE))] #value
hth
daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Alfredo Alessandrini
Gesendet: Tuesday, June 23, 2009 10:00 AM
An: r-help at r-project.org
Betreff: [R] first value...
Hi,
I've a vector like this:
> inc
[1] NA NA NA NA NA NA NA
[8] NA NA NA NA NA NA NA
[15] NA NA NA NA NA NA NA
[22] NA NA NA NA NA NA NA
[29] NA NA NA NA NA NA NA
[36] NA NA NA NA NA NA NA
[43] NA NA NA NA NA NA NA
[50] NA NA NA NA NA NA NA
[57] NA NA NA NA NA NA NA
[64] NA NA NA NA NA NA NA
[71] NA NA NA NA NA NA NA
[78] NA NA NA NA 13.095503 10.140119 7.989186
[85] 8.711888 7.201234 13.029250 14.430755 8.662832 8.810785 14.421302
[92] 7.614985 7.548091 9.843389 14.977402 20.875255 7.787543 2.005056
[99] 4.016916 3.601773 4.140390 7.241999 13.280794 18.038902 18.762169
I must obtain the position of first value of the vector...
In this case is 82.
> inc[82]
[1] 13.09550
Regards,
Alfredo
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list