Re: [R] Need a faster function to replace missing data

2009-05-26 Thread Tim Clark
jim holtman > Subject: Re: [R] Need a faster function to replace missing data > To: "Tim Clark" > Cc: r-help@r-project.org > Date: Friday, May 22, 2009, 4:59 PM > Here is a modification that should > now find the closest: >   > > > myvscan<-data.frame(c(1,NA,1.5

Re: [R] Need a faster function to replace missing data

2009-05-22 Thread jim holtman
ng to use which.min to get the > closet date but can't seem to get it to work right either. > > Aloha, > > Tim > > > Tim Clark > Department of Zoology > University of Hawaii > > > --- On Fri, 5/22/09, jim holtman wrote: > > > From: jim holtman >

Re: [R] Need a faster function to replace missing data

2009-05-22 Thread Tim Clark
Aloha, Tim Tim Clark Department of Zoology University of Hawaii --- On Fri, 5/22/09, jim holtman wrote: > From: jim holtman > Subject: Re: [R] Need a faster function to replace missing data > To: "Tim Clark" > Cc: r-help@r-project.org > Date: Friday, May 22, 200

Re: [R] Need a faster function to replace missing data

2009-05-22 Thread jim holtman
I think this does what you want. It uses 'findInterval' to determine where a possible match is: > myvscan<-data.frame(c(1,NA,1.5),as.POSIXct(c("12:00:00","12:14:00","12:20:00"), format="%H:%M:%S")) > # convert to numeric > names(myvscan)<-c("Latitude","DateTime") > myvscan$tn <- as.numeric(myvsca

Re: [R] Need a faster function to replace missing data

2009-05-22 Thread William Dunlap
reference) or NA # following needed if reference is not sorted i <- order(reference)[i] # following needed if x is not sorted i[order(order(x))] } Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.com > -Original Message- > From: r

Re: [R] Need a faster function to replace missing data

2009-05-22 Thread Dieter Menneq
Tim Clark yahoo.com> writes: > > I need some help in coming up with a function that will take two data sets, determine if a value is missing in > one, find a value in the second that was taken at about the same time, and substitute the second value in for > where the first should have been. T

[R] Need a faster function to replace missing data

2009-05-21 Thread Tim Clark
Dear List, I need some help in coming up with a function that will take two data sets, determine if a value is missing in one, find a value in the second that was taken at about the same time, and substitute the second value in for where the first should have been. My problem is from a fish t