Pretty basic performance question from an R newbie. I\'d like to assign a group ID to each row in a data frame by unique combinations of fields. Here\'s my current approach:
Try using the id function (also in plyr):
id
df$id <- id(df[c("st.num", "st.name")], drop = TRUE)
Update:
The id function is considered deprecated since dplyr version 0.5.0. The function group_indices provides the same functionality.
group_indices