Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Join NHANES tables by sequence ID
# Use Reshape2 to melt exercise data from "wide" to "long" format
# Perform left_join on sequence ID to combine exercise information with demographic
exerciseMins <- melt(data = exercise,id.vars = "seqID",
measure.vars = c('minsVigWork','minsModWork','minsWalkBike','minsVigRec','minsModRec'),
variable.name = 'exercise.type',value.name = 'mins.per.day') %>%
left_join(demographics,by='seqID')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment