Add rowname column to colwise #61

macrakis opened this Issue Oct 17, 2011 · 7 comments


None yet
4 participants

Currently, sapply(df,f) includes rownames in the result, but colwise(f)(df) does not.

Suggest adding a (possibly optional) rowname column in colwise.

I doubt this will be implemented. See Issue #59 where Hadley says "I need to put this in big letters up front somewhere: plyr does not support rownames, and will silently drop any input rownames." But it is not my place (or ability) to close the issue.

Hadley's comment on this in email was:

I really dislike rownames, and all plyr functions currently drop them.
It might be useful to have an option to add them as a new column

So it seems clear that rownames will not be preserved qua rownames, but there's a possibility that they'll be available as a separate column.

@macrakis macrakis closed this Oct 17, 2011

@macrakis macrakis reopened this Oct 17, 2011



hadley commented Oct 5, 2012

Maybe called name_rows? I think it would be something like:

name_rows <- function(df) {
  df$.rownames <- rownames(df)

hadley commented Oct 5, 2012

I wonder if there should be an opposite version for symmetry.

row_names <- function(df) {
  rownames(df) <- df$.rownames

Any ideas for better names?


wch commented Oct 8, 2012

Maybe save_rownames and restore_rownames?

I actually don't like "save" that much. Maybe stash?


hadley commented Oct 8, 2012

What about push_rownames and pop_rownames? I kind of like the idea of expressing the symmetry in the operation through symmetry in function names (a la name_rows and row_names)

@hadley hadley closed this in beae4a6 Oct 8, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment