-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Oftentimes, when I am working with a data frame returned from another package, important information will be encoded using the row names of the data frame. Using dplyr, this data should be added as a column (as it is dropped by the manipulation verbs). Something like the following would be useful:
# nse
add_rownames <- function(.data, col_name = "rownames") {
col_name <- deparse(substitute(col_name))
add_row_names_(.data, col_name)
}
# se
add_rownames_ <- function(.data, col_name = "rownames") {
row_names <- data_frame(rownames(.data))
names(row_names) <- col_name
dplyr:::cbind_list(row_names, .data)
}Maybe make the SE version generic?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancement