Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure arrange() works with list-columns, data.frame-columns and matrix-columns. #90

Open
3 tasks
nathaneastwood opened this issue Apr 18, 2021 · 0 comments
Labels
feature request New feature or request

Comments

@nathaneastwood
Copy link
Owner

Arrange should be able to handle:

  • list columns
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 columns
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"
)
  • `matrix 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"
)
@nathaneastwood nathaneastwood added the feature request New feature or request label Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant