2
Suppose the following database:
set.seed(1)
df_1 <- data.frame(x = replicate(n = 3, expr = sample(x = 1:3, size = 10, replace = TRUE)))
By the way, with the package dplyr
I tried to:
library(dplyr)
df_1 %>%
arrange_if(.predicate = desc(is.integer))
Error in x[! nas] : Object of type 'builtin' is not subsettable
In addition: Warning message:
In is.na(x) is.na() Applied to non-(list or vector) of type 'builtin'
With arrange
, arrange_all
and arrange_at
, desc
works.
- How to adjust
arrange_if
in descending order?
The syntax of these functions with
_if
,_at
and_all
is kind of confusing. In the next version ofdply
will have a functionacross
that replaces them and is more standardized for use with other functions such asmutate
andsummarize
.– Jorge Mendes
Thanks for the tip, @Jorge. Following it, I checked the function
across
is already available. To whom interested, just rotate:remotes::install_github("tidyverse/dplyr")
– neves