mercredi 8 mars 2017

classify data based on length of continous time

probably I'm asking something very simple but I'm new with R and I didn't really find anything similar here on the forum.

I have a data frame which looks like this:

             bigDData.dt bigDData.a_temp bigDData.diff bigDData.V33
3148  2009-03-31 09:50:00            8.45      6.071806          yes
3149  2009-03-31 09:55:00            9.31      6.802639          yes
3150  2009-03-31 10:00:00           10.55      7.898750          yes
3151  2009-03-31 10:05:00           11.16      8.357361          yes
3152  2009-03-31 10:10:00           11.37      8.413889          yes
3153  2009-03-31 10:15:00           11.51      8.398750          yes
3154  2009-03-31 10:20:00           11.77      8.499306          yes
3155  2009-03-31 10:25:00           12.42      8.979583          yes
3156  2009-03-31 10:30:00           12.76      9.144722          yes
3412  2009-04-01 07:50:00            7.33      6.233472          yes
3413  2009-04-01 07:55:00            7.65      6.455972          yes
3414  2009-04-01 08:00:00            7.97      6.676250          yes
3415  2009-04-01 08:05:00            8.12      6.724583          yes
3416  2009-04-01 08:10:00            8.40      6.899028          yes

I'm intrested in knowing the duration of consecutive data. For example I would like to know that the duration of my data on the 2009-04-01 is of 20 minutes. Then I would like to classify the data based on the length of the consecutive data. I tried with a for is loop with an if condition inside but I'm not very able to formulate it in a good way, so I don't get what I want. Maybe is there an R-package/function which is able to do this? Or maybe does someone of you have an idea on how to write the loop in a proper way?

Thank you very much!

Aucun commentaire:

Enregistrer un commentaire