Open nathaneastwood opened 3 years ago
Arrange should be able to handle:
list
df <- structure(list(x = 1:3, y = list(3, 2, 1)), row.names = c(NA, -3L), class = "data.frame") expect_equal( arrange(df, y), df, info = "arrange handles list columns: 1" ) df <- structure(list(x = 1:3, y = list(sum, mean, sd)), row.names = c(NA, -3L), class = "data.frame") expect_equal( arrange(df, y), df, info = "arrange handles list columns: 2" )
data.frame
df <- data.frame(x = 1:3) df[, "y"] <- data.frame(z = 3:1) expect_equal( arrange(df, y), { out <- data.frame(x = 3:1) out[, "y"] <- data.frame(z = 1:3) out }, info = "arrange handles data.frame columns" )
df <- data.frame(x = 1:3) df[, "y"] <- matrix(6:1, ncol = 2) expect_equal( arrange(df, y), df[3:1, ], info = "arrange handles matrix columns" )
Arrange should be able to handle:
list
columnsdata.frame
columns