Skip to content

Commit

Permalink
Bug fixes for arrange
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Apr 19, 2011
1 parent 21fc841 commit d6a0ebe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Version 1.6
------------------------------------------------------------------------------

* allow arrange to work with one column data frames

Version 1.5.2
------------------------------------------------------------------------------

Expand Down
6 changes: 5 additions & 1 deletion R/helper-arrange.r
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
#' arrange(mtcars, cyl, desc(disp))
arrange <- function(df, ...) {
ord <- eval(substitute(order(...)), df, parent.frame())
unrowname(df[ord, ])
if(length(ord) != nrow(df)) {
stop("Length of ordering vectors don't match data frame size",
call. = FALSE)
}
unrowname(df[ord, , drop = FALSE])
}

#' Descending order.
Expand Down

0 comments on commit d6a0ebe

Please sign in to comment.