mardi 1 mars 2016

How to identify a change of the day in my timestamp table?

In the last step, I tried to set the oldDay equal to day so that r prints out "new day" every time the day changes. Unfortunately, only the first element from my table is used so I think there is a mistake in the last line (oldDay = day).

## extract day & Month out of timestamp ##
day = as.numeric(format(strptime(timestamp,format = '%d.%m.%Y %H:%M:%S'), "%d.%m"))

## print out "new day" when day changes ##
oldDay = 0
 if (day != oldDay){
 print("new day")
 oldDay = day
}

Aucun commentaire:

Enregistrer un commentaire