I asked a similar question to this here:
Now, my dataset has expanded a little bit so I want to preserve two columns of data in the long format. Sorry, I couldn't figure out how to extend the answers that were provided to this situation.
> id <- c(1000, 1000, 1000, 1001, 1001, 1001)
> type <- c("A", "B", "B", "C", "C", "A")
> zipcode <- c(14201, 32940, 94105, 22020, 94104, 14201)
> dates <- c("10/5/2019", "10/5/2019", "10/5/2019", "9/17/2020", "9/17/2020", "9/17/2020")
> df <- as.data.frame(cbind(id, type, dates, zipcode))
> df
id type dates zipcode
1 1000 A 10/5/2019 14201
2 1000 B 10/5/2019 32940
3 1000 B 10/5/2019 94105
4 1001 C 9/17/2020 22020
5 1001 C 9/17/2020 94104
6 1001 A 9/17/2020 14201
I would like df to look something like this (it doesn't have to be exactly the same):