r - Using ddply on dataframe with dates in POSIXlt time -


the problem:

you have data.frame (df) consists of columns of posixlt date format.

output of str(df) following:

$identifier : int 1 1 1 1 1 1 1 1 1 1 ... $date.time : posixlt, format: "2010-06-01 07:27:00" "2010-06-01 07:27:00"

if use

ddply(df, identifier, summarise, min.time = min(date.tim)

you similar error:

'names' attribute [11] must same length vector [10]

solution mentioned below.

the problem documented in github issue

it dataframe's inability handle posixlt date.

"posixct" more convenient including in data frames, , "posixlt" closer human-readable forms.

the solution mentioned in issue following

df$tm <- as.posixct(strptime(paste(dates, times), "%m/%d/%y %h:%m:%s")) ddply(df, ~var1, dim) 

Popular posts from this blog