search for: xandaynight

Displaying 1 result from an estimated 1 matches for "xandaynight".

2013 Jun 10
1
modify and append new rows to a data.frame using ddply
...time=sunset [i+2]?01-01-2000 21:01:00 , 30 # previously row i+1th [i+3]?01-01-2000 21:01:30 , 30 # previously row i+2th . . . I attach a dput with a selection of my data.frame. Here is a piece of existing code that I am trying to adapt just for the daytime/night time change: ? require(plyr) ? xandaynight <- ddply( xan, .(Ring), function(df1){ ? # index of day/night changes ? ind <- c( FALSE, diff(df$dif) == 1 ) ? add <- df1[ind,] ? add$timepos <- add$dusk ? # rearrangement ? df1 <- rbind( df1, add ) ? df1 <- df1[order(df1$timepos),] ? # recalculation of act ? df1$act2 <- c( dif...