Skip to content

Instantly share code, notes, and snippets.

@mrchypark
Last active December 20, 2020 08:56
Show Gist options
  • Save mrchypark/0edc57c24f70bb69ec373ac314b653f6 to your computer and use it in GitHub Desktop.
Save mrchypark/0edc57c24f70bb69ec373ac314b653f6 to your computer and use it in GitHub Desktop.
grade <-
as.data.frame(cbind(
ID = c(LETTERS[1:5]),
GPA = list('A+','F', c('C-','B','A+'), c('A','A+'), 'D')
))
unstack <- function(grade){
do.call(rbind, apply(grade, 1, function(x)
data.frame(ID = x$ID, GPA = x$GPA)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment