Re: [R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread Jeff Newmiller
But still wrong... needs to be calculated in two steps because the cars are seen in multiple frames. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live G

Re: [R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread jim holtman
FYI, increased it to 3M rows of data and it took 0.3 seconds to summarize it: > system.time({ + # summarize the slot & Class + result <- DF[ + , list(Total = .N # count of entries + , mVel = mean(velocity) # average velocity + ) + , keyby = 'slot,Class' + ] + }) us

Re: [R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread jim holtman
Here is another way of doing it using the data.table package. Tried using new new 'dplyr' package, but it had problems. > # create some test data > N <- 3 # rows of data > set.seed(1) > DF <- data.frame(vehicle = sample(1:5, N, TRUE) + , frame = sample(22:9322, N, TRUE) +

Re: [R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread Jeff Newmiller
Sorry, messed up the second ddply example: dta3 <- ddply( dta2, c("slot","classf"), function(DF){data.frame( Total=nrow(DF), MeanVelocity= mean( DF$TimeMeanVelocity ) ) } ) --- Jeff NewmillerThe .

Re: [R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread Jeff Newmiller
While you seem to be making some progress in communicating your problem, the format is still HTML (so it is a mess) and the subject and approach of the question are still a poor fit for this list. We are not here to DO your work for you, yet you seem to have an overly long list of "needs" that s

Re: [R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread Bert Gunter
Just curious -- why do you continue to post in HTML when you have been asked not to? Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Sat, Jan 25, 20

[R] Corrected - R 3.0.2 How to Split-Apply-Combine using various Columns

2014-01-25 Thread umair durrani
Hello everyone,Here is the version using dput. I am sorry for the junk I posted before. I have a large vehicle trajectory data of which following is a small part: structure(list(vehicle = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,2L, 2L), frame = c(221L, 222L, 223L, 224L, 115L, 116L, 117L, 118L, 11