arrange.tbl_lazy

0th

Percentile

Arrange rows by variables in a remote database table

Order rows of database tables by an expression involving its variables.

Usage
# S3 method for tbl_lazy
arrange(.data, ..., .by_group = FALSE)
Arguments
.data

A tbl. All main verbs are S3 generics and provide methods for tbl_df(), dtplyr::tbl_dt() and dbplyr::tbl_dbi().

...

Comma separated list of unquoted variable names, or expressions involving variable names. Use desc() to sort a variable in descending order.

.by_group

If TRUE, will sort first by grouping variable. Applies to grouped data frames only.

Value

An object of the same class as .data.

Missing values

Compared to its sorting behavior on local data, the arrange() method for most database tables sorts NA at the beginning unless wrapped with desc(). Users can override this behaviour by explicitly sorting on is.na(x).

Aliases
  • arrange.tbl_lazy
Examples
# NOT RUN {
library(dplyr)

dbplyr::memdb_frame(a = c(3, 4, 1, 2)) %>%
  arrange(a)

# NA sorted first
dbplyr::memdb_frame(a = c(3, 4, NA, 2)) %>%
  arrange(a)

# override by sorting on is.na() first
dbplyr::memdb_frame(a = c(3, 4, NA, 2)) %>%
  arrange(is.na(a), a)

# }
Documentation reproduced from package dbplyr, version 1.4.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.