Skip to content

Instantly share code, notes, and snippets.

@verajosemanuel
Last active November 14, 2017 09:39
Show Gist options
  • Save verajosemanuel/190b712d546349d76df16c6c336a5afd to your computer and use it in GitHub Desktop.
Save verajosemanuel/190b712d546349d76df16c6c336a5afd to your computer and use it in GitHub Desktop.
matching and merging #df in #R
grades <- c(1, 2, 2, 3, 1)
info <- data.frame(
grade = 3:1,
desc = c("Excellent", "Good", "Poor"),
fail = c(F, F, T)
)
# info table with grades
id <- match(grades, info$grade)
info[id, ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment