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
ddply error: Error in attributes(out) - attributes(col) : 'names' attribute must be the same length as the vector
The issue was with the "names" attribute of the "Species" column:
$ Species : Factor w/ 10 levels "Arctosafulvolineata",..: 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "names")= chr "1" "1" "1" "1" ...
I removed them with the following code and ddply worked:
> names(uncertainty.long$Species) <- "NULL"
> ddply(uncertainty.long, .(Species), "nrow")
Species nrow
1 Arctosafulvolineata 3800
2 Argyronetaaquatica 3800
3 Dolomedesplantarius 3800
4 Enoplognathamordax 3800
5 Iciussubinermis 3800
6 Neonvalentulus 3800
7 Pardosabifasciata 3800
8 Pardosaoreophila 3800
9 Piratauliginosus 3800
10 Trochosaspinipalpis 3800
Related Topics
"Correct" Way to Specifiy Optional Arguments in R Functions
Last Observation Carried Forward in a Data Frame
Converting Nested List to Dataframe
Detecting Operating System in R (E.G. for Adaptive .Rprofile Files)
Cut Function in R- Labeling Without Scientific Notations for Use in Ggplot2
Hosting and Setting Up Own Shiny Apps Without Shiny Server
Roxygen2 - How to Properly Document S3 Methods
Adding Text to a Grid.Table Plot
Write Many Files in a for Loop
Load Multiple Packages at Once
How to Make Geom_Text Plot Within the Canvas's Bounds
Create Categorical Variable in R Based on Range
Align Ggplot2 Plots Vertically
Date Conversion from Posixct to Date in R
Update Subset of Data.Table Based on Join