In my analysis code I've been using broom::tidy to extract a regression slope per group in a data frame:
E1.first_trial_df <- data.frame(
search_type = factor(rep(1:3, each = 10)),
set_size = rep(1:10,3),
RT = runif(300, min = 0, max = 2500)
)
E1.search_slopes_first_trial <- E1.first_trial_df %>%
group_by(search_type) %>%
do(model=lm(RT~set_size,data=.)) %>%
broom::tidy(model) %>%
filter(term=='set_size')
I had an issue with R so I reinstalled R, Rstudio and all my packages, and I guess on the way I've upgraded to a new version of broom. So I'm now getting the following error message:
Error in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm) : Calling var(x) on a factor x is defunct. Use something like 'all(duplicated(x)[-1L])' to test for a constant vector. In addition: Warning messages: 1: Data frame tidiers are deprecated and will be removed in an upcoming release of broom. 2: In mean.default(X[[i]], ...) : argument is not numeric or logical: returning NA 3: In mean.default(X[[i]], ...) : argument is not numeric or logical: returning NA
Any idea what's happening here, and how to fix it? Thanks!