pivot_wider does not seem to work with missing values. How to turn spread() into pivot_wider() when there is missing values
问题 as the spread() function is being replaced by the new pivot_wider() function, I was trying to use the pivot_wider() from now on but it does not seem to work because of the missing values. Any help is much appreciated # This is an example I saw on the web surveys <- read.csv("http://kbroman.org/datacarp/portal_data_joined.csv", stringsAsFactors = FALSE) library(dplyr) surveys %>% filter(taxa == "Rodent", !is.na(weight)) %>% group_by(sex,genus) %>% summarize(mean_weight = mean(weight)) %>%