I use tidyverse (and its environment) almost every day and from time to time I have to come back to previous/old analyses. Unfortunately, it's not easy to keep up the track of the changes that have been made to the package.
This script is pretty functional and it performs what I want (it is used inside a function with other commands)
ds <- data.frame(result = rnorm(100,5,2),
time = c("1","2"))
library(tidyverse)
library(broom)
ds %>%
summarise_at(vars("result"),
funs(list(tidy(t.test(. ~ time, paired=TRUE))))) %>% map(1)
I know this is not the most elegant syntax. Now, this message comes after the command:
funs() is soft deprecated as of dplyr 0.8.0 Please use a list of either functions or lambdas:
# Simple named list:
list(mean = mean, median = median)
# Auto named with `tibble::lst()`:
tibble::lst(mean, median)
# Using lambdas
list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
All my attempt to fix it gives me a message...
> ds %>%
+ summarise_at(vars("result"),
+ lst(tidy(t.test(. ~ time, paired=TRUE)))) %>% map(1)
Error in model.frame.default(formula = . ~ time) :
invalid type (list) for variable '.'
> ds %>%
+ summarise_at(vars("result"),
+ list(list(tidy(t.test(. ~ time, paired=TRUE))))) %>% map(1)
Error in model.frame.default(formula = . ~ time) :
invalid type (list) for variable '.'
> ds %>%
+ summarise_at(vars("result"),
+ list(list(tidy(~ t.test(. ~ time, paired=TRUE))))) %>% map(1)
Error: No tidy method for objects of class formula
So.. first question: Any clue about fixing it?
second: where can I follow these (constant) updates?
Three: I use tidyverse because I enjoy the way it deals with commands. It is pretty intuitive, but I see as an important side effect this constantly changes ... Should I try to move all my routines to R base (Probably, R base will not change its function ...)?
Thanks all.