Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Yolande Tra
Thank you Rui. Very helpful. Yolande. On Wed, Jul 18, 2012 at 1:37 PM, Rui Barradas wrote: > Hello, > > Try the following. > > > for(i in 1:dim(diveData_2008)[1]){ > # Which dive is this observation from > thisIndex <- as.character(index(diveData_**2008[i,])) > thisIndex <- as.PO

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Rui Barradas
Hello, Try the following. for(i in 1:dim(diveData_2008)[1]){ # Which dive is this observation from thisIndex <- as.character(index(diveData_2008[i,])) thisIndex <- as.POSIXct(thisIndex) dive_id <- diveCond_all$dive_id[diveCond_all$timestamp == thisIndex] #

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Yolande Tra
it is a function from library(xts) On Wed, Jul 18, 2012 at 1:15 PM, Jean V Adams wrote: > What is the function index() that you use in this line of code? > thisIndex <- as.character(index(diveData_2008[i,])) > > Is it from some package? Or a function you wrote yourself? > I'm trying to run the

Re: [R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Jean V Adams
What is the function index() that you use in this line of code? thisIndex <- as.character(index(diveData_2008[i,])) Is it from some package? Or a function you wrote yourself? I'm trying to run the code you submitted, but I don't have a function called index(). Jean Yolande Tra wrote on 07/18

[R] loop searching the id corresponding to the given index (timestamp)

2012-07-18 Thread Yolande Tra
Hello, I have the following loop for two data sets: diveData_2008 and diveData_2009. It uses two other data: diveCond_all and fishTable. The problem is at the point to identify the dive_id for the given index (index is timestamp). It keeps on saying for the1st loop Error in fishReport$dive_id[i] <