Hello!
New to the community, and data wrangling in general!
I have a large data set with student information that I need to arrange into a specific upload format. I need one row per student, and to collapse all the repeating rows into columns of sequential information.
This is an example of the data I have:
student <- c('a', 'a', 'b', 'c', 'c', 'd')
contact <- c( 'mother', 'father', 'mother', 'grandmother', 'grandfather', 'aunt')
address <- c( '115', '115', '75th', 'Pacific', 'Atlantic', 'georgetown')
example <- tibble(student, contact, address)
However, I need it to look like this:
student1 <- c('a', 'b', 'c', 'd')
contact1 <- c('mother','mother','grandmother', 'aunt')
address1 <- c('115', '75th', 'pacific', 'georgetown')
contact2 <- c('father', 'na', 'grandfather', 'na')
address2 <- c('115', 'na', 'Altantic', 'na')
example2 <- tibble(student1, contact1, address1, contact2, address2)
Any help is appreciated!