Reputation: 15
I have longitudinal data and need to check whether contact info remained the same over time. A simple version would look like this
id<-c(1,1,2,2,2,3)
em1<-c("[email protected]",NA,"[email protected]",NA,NA,"[email protected]")
em2<-c(NA,"[email protected]",NA,"[email protected]",NA,NA)
em3<-c(NA,NA,NA,NA,"[email protected]",NA)
email<-tibble(id,em1,em2,em3)
I have 2 questions:
email_tidy<-email %>%
pivot_longer(em1:em3, values_to = "score",values_drop_na = TRUE) %>%
pivot_wider(id_cols = id, names_from = name, values_from = score)
to get the wider format. However, in the real data this gives an error that "Some attributes are incompatible." I tried transforming to character but that resulted in a different error "Values from score
are not uniquely identified".
Upvotes: 0
Views: 10