Skip to content

Commit

Permalink
deprecate add_rownames()
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Müller committed Mar 21, 2016
1 parent 9f30946 commit fb28450
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions R/dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ as_data_frame.grouped_df <- function(x, ...) {

#' Convert row names to an explicit variable.
#'
#' Deprecated, use \code{\link[tibble]{rownames_to_column}} instead.
#'
#' @param df Input data frame with rownames.
#' @param var Name of variable to use
#' @export
Expand All @@ -27,6 +29,10 @@ as_data_frame.grouped_df <- function(x, ...) {
#'
#' mtcars %>% add_rownames()
add_rownames <- function(df, var = "rowname") {
warning(
"Deprecated, use tibble::rownames_to_column() instead.",
call. = FALSE)

stopifnot(is.data.frame(df))

rn <- as_data_frame(setNames(list(rownames(df)), var))
Expand Down
2 changes: 1 addition & 1 deletion man/add_rownames.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb28450

Please sign in to comment.