I used to use dplyr everywhere, but have included some plyr functions . To be honest I do not know what the difference is or why things have changed . The same code results in different dataframes depending on whether I have imported plyr or tidyverse . What I wanted to have is a dataframe named newborn_stat containing unique pids in each row and a new c_pos column.
raw_file_contents<- data.frame( pid=c(1,2,2,3,3), C_SYMP=c("Y","N","Y","N","N"))
newborn_stat<- raw_file_contents %>%
group_by(pid) %>%
summarise(c_pos= any( C_SYMP == "Y", na.rm = TRUE))
instead I would get a data frame ,newborn_stat, of 1 rows with c_pos equal to TRUE. If I use dplyr:: with the group_by and summarise , I think I get the right answer. Why does this happen? I have been using a Rmd notebook, so when I tried to run the previous chunk containing this line, things didn't work.