Skip to content
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

dplyr 1.0.0 update throwing error in plot_compare_stage #270

Open
hdugan opened this issue Jun 1, 2020 · 9 comments
Open

dplyr 1.0.0 update throwing error in plot_compare_stage #270

hdugan opened this issue Jun 1, 2020 · 9 comments

Comments

@hdugan
Copy link
Collaborator

hdugan commented Jun 1, 2020

With the new dplyr update v.1.0.0, get the following error:

plot_compare_stage(nc_file, field_file)
Error: `vec_cast.POSIXct.POSIXct()` is implemented at C level.
This R function is purely indicative and should never be called.

This is traced back to vec_rbind in the vctrs package.
I actually think this might be a dplyr bug... so it might sort itself out.

Until then, keep the old versions of the following packages:

install_version("dplyr", version = "0.8.5", repos = "http://cran.us.r-project.org")
install_version("vctrs", version = "0.2.4", repos = "http://cran.us.r-project.org")
install_version("tidyr", version = "1.0.0", repos = "http://cran.us.r-project.org")

We might have some other dplyr errors in other functions as well

@jordansread
Copy link
Member

yucky error. is it in the master version or the ggplot update branch? or both?

@hdugan
Copy link
Collaborator Author

hdugan commented Jun 4, 2020

ggplot update branch only. (fyi, the master branch still has dependencies on GLMr)

There have been lots of dplyr issues opened in the last week, so I'm just going to wait on this for a little bit.

@jordansread
Copy link
Member

I ran into this on the master branch today too

@jordansread
Copy link
Member

I get it when attempting to left_join with DateTime as the "by" argument. Since DateTime here is a POSIXct. I got around it by using date = as.Date(lubridate::ceiling_date(DateTime, 'days')) and joining on date instead, since I was working with daily output anyhow.

@hdugan
Copy link
Collaborator Author

hdugan commented Jun 24, 2020

🤕 I'll look into it this week.

@jordansread
Copy link
Member

Nevermind me saying it was in the master - the error was actually something I hit after get_var, so I was doing the join outside of glmtools

@hdugan
Copy link
Collaborator Author

hdugan commented Jun 24, 2020

Good!
Trying to understand why this is happening is bizarre, and I'm surprised there isn't more stackoverflow discussions about it. POSIXct is throwing the errors. Works if I convert to POSIXlt (which I haven't used in a long time).

@hdugan
Copy link
Collaborator Author

hdugan commented Jun 24, 2020

Figured it out (or at least part of it). In the get_time function, hours_since <- ncvar_get(glm_nc, "time") returns an array as opposed to a vector. This adds 'dimensions' to the object which downstream cause a lot of problems. By changing to a numeric vector everything seems to work as previously.

get_time  <-  function(glm_nc){
	hours_since  <- ncvar_get(glm_nc, "time")
	time_info <- get_time_info(glm_nc)

	time <- time_info$startDate + time_info$time_unit * hours_since * 60*60*24

	return(time)
	
}

@padilla410
Copy link
Contributor

This bug is related to the issues in #275. dplyr 1.0.0 outputs data summaries into tibbles. A reproducible example:

library(dplyr)

data(iris)

# a `data.frame` object
class(iris)

out <- iris %>% 
  group_by(Species) %>% 
  summarise(count = n())

# a `tibble` object
out

The output:

> library(dplyr)
> 
> data(iris)
> 
> # a `data.frame` object
> class(iris)
[1] "data.frame"
> 
> out <- iris %>% 
+   group_by(Species) %>% 
+   summarise(count = n())
> 
> # a `tibble` object
> out
# A tibble: 3 x 2
  Species    count
  <fct>      <int>
1 setosa        50
2 versicolor    50
3 virginica     50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants