meaning of ddply error: 'names' attribute [9] must be the same length as the vector [1] meaning of ddply error: 'names' attribute [9] must be the same length as the vector [1] r r

meaning of ddply error: 'names' attribute [9] must be the same length as the vector [1]


I fixed this problem I was having by converting format from POSIXlt to POSIXct as Hadley suggests above - one line of code:

    mydata$datetime<-strptime(mydata$datetime, "%Y-%m-%d %H:%M:%S") # original conversion from datetime string : > class(mydata$datetime) [1] "POSIXlt" "POSIXt"     mydata$datetime<-as.POSIXct(mydata$datetime) # convert to POSIXct to use in data frames / ddply


You have probably already seen this and it has not helped. I guess we probably do not have an answer yet because people cannot reproduce your error.

A dput or smaller head(dput()) might help this. But here is an alternative using base:

x <- data.frame(A=c("a","b","c","a"),B=c("e","d","d","d"))ddply(x,.(A),summarise, Freq = length(B))  A Freq1 a    22 b    13 c    1 tapply(x$B,x$A,length)a b c 2 1 1 

Does this tapply work for you?

x2 <- data.frame(A=c("removed@removed.ca", "removed@removed.net"),                 B=c("please help a newbie compile mplayer :-)",                      "re: please help a newbie compile mplayer :-)"))tapply(x2$B,x2$A,length)removed@removed.ca removed@removed.net               1                   1 ddply(x2,.(A),summarise, Freq = length(B))                    A Freq1  removed@removed.ca    12 removed@removed.net    1

you could also try more simply:

table(x2$A) removed@removed.ca removed@removed.net               1                   1 


I had a very similar problem, although not sure if it is an identical one. I received the error below.

Error in attributes(out) <- attributes(col) :   'names' attribute [20388] must be the same length as the vector [128]

I don't have any variable in list mode, so Mota's solution does not work on my situation. The way I sorted the problem is to remove plyr 1.8 and manually install plyr 1.7. The error then is gone. I've also tried to reinstall plyr 1.8 and replicated the problem.

HTH.