-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in Data Frame #3
Comments
Thanks for your post and for pointing this out. We continue to work on the code base and this may get fixed as part of an effort to re-write code but there's not a particular schedule for that. In the mean time, we welcome your contributions. Thanks again. |
Ah okay, I understand. I'll try and come with a solution in the coming weeks. |
Hi, I've come up with a solution for the hours.R function only in the context of powerstate_preprocessing function. I have not tested how it works in other functions yet. Basically, I replaced the mapper function with a for loop to get it to work. I'm not sure why this solution works but it seems to work across multiple datasets. |
So this comes long after the last comment, but here's a modified version of the hours() function that works for me across several of the pre-processing functions. hours = function(timestamps){
days = timestamps %>% unlist %>% as.POSIXlt(origin = "1970-01-01") %>%
as.character %>%
map(function(x){if(is.na(x)){return(c("NA","NA"))}else{return(strsplit(x, " "))}}) %>%
unlist %>%
matrix(nrow=2) %>%
t
hours =
days[,2] %>%
map(strsplit, split=":") %>%
unlist() %>%
as.numeric() %>% #Convert from factor
matrix(ncol=3, byrow = TRUE) %>%
data.frame() %>%
dplyr::rename(hour=X1, min=X2, sec=X3) %>%
apply(1, function(times) sum(times * c(1, 1/60, 1/3600)))
days = days[,1]
output = as_data_frame(cbind(hours=hours, days=days))
output["hours"] = lapply(output["hours"], as.numeric)
return(output)
} |
Hi,
I'm trying to run the powerstate_preprocessing function. I ran it and error occurred which I traced to the hours function. The exact error I'm getting is: "Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 11, 1963". It is occurring because on line 10 inside the map function is transforming the hours variable into 11 observations versus the needed 1963 observations. This is a problem on line 14 when cbind is applied and that's when the error occurs.
Thoughts?
The text was updated successfully, but these errors were encountered: