Hello, i would like to ask you another question. Is exist anymethod to vectors that tells me the last element?That is to say,I have a vector, I want to return the position of last element. I hope having explained. A greeting, Ignacio. -- View this message in context: http://old.nabble.com/Method-tp26493442p26493442.html Sent from the R help mailing list archive at Nabble.com.
myVector <- c(seq(10),23,35) length(myVector) myVector[length(myVector)] it's unclear to me which of the two you want ... HTH, Joh yonosoyelmejor wrote:> > Hello, i would like to ask you another question. Is exist anymethod to > vectors that tells me the last element?That is to say,I have a vector, I > want to return the position of last element. I hope having explained. > > A greeting, > Ignacio.
It isn't entirely clear what you want. Maybe one of these? x <- runif(45) # make a test vector length(x) # position of the last element x[length(x)] # value of the last element Sarah On Tue, Nov 24, 2009 at 5:18 AM, yonosoyelmejor <yonosoyelmejor at hotmail.com> wrote:> > Hello, i would like to ask you another question. Is exist anymethod to > vectors that tells me the last element?That is to say,I have a vector, I > want to return the position of last element. I hope having explained. > > A greeting, > Ignacio. > ---- Sarah Goslee http://www.functionaldiversity.org
yonosoyelmejor escribi?:> Hello, i would like to ask you another question. Is exist anymethod to > vectors that tells me the last element?That is to say,I have a vector, I > want to return the position of last element. I hope having explained. > > A greeting, > Ignacio. >vect1 <- c(1,2,3) vect1[length(vect1)] Hope this helps. Saludos, Keo.
On Nov 24, 2009, at 10:20 AM, Keo Ormsby wrote:> yonosoyelmejor escribi?: >> Hello, i would like to ask you another question. Is exist anymethod >> to >> vectors that tells me the last element?That is to say,I have a >> vector, I >> want to return the position of last element. I hope having explained. >> >> A greeting, >> Ignacio. >> > vect1 <- c(1,2,3) > vect1[length(vect1)]As well as: tail(vect1, 1)>-- David Winsemius, MD Heritage Laboratories West Hartford, CT