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

[R] Add bindings for pmin() and pmax() #28686

Closed
asfimport opened this issue Jun 4, 2021 · 2 comments
Closed

[R] Add bindings for pmin() and pmax() #28686

asfimport opened this issue Jun 4, 2021 · 2 comments

Comments

@asfimport
Copy link
Collaborator

asfimport commented Jun 4, 2021

ARROW-12751 adds a row-wise min/max kernel to the C++ library. Add R bindings so users can call pmin() and pmax() in dplyr verbs. Use ElementWiseAggregateOptions to ensure that NA values are handled the same as in base::pmin() and base::pmax().

Reporter: Ian Cook / @ianmcook
Assignee: Mauricio 'Pachá' Vargas Sepúlveda / @pachadotdev

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-12967. Please see the migration documentation for further details.

@asfimport
Copy link
Collaborator Author

Mauricio 'Pachá' Vargas Sepúlveda / @pachadotdev:
PR sent !
this caught my attention, one should expect double instead of non-representable, but the R function works well

write_dataset(df, "df")

df2 <- open_dataset("df")

df2 %>% 
  mutate(
    max_val_1 = pmax(val1, val2, val3),
    max_val_2 = pmax(val1, val2, val3, na.rm = T),
    min_val_1 = pmin(val1, val2, val3),
    min_val_2 = pmin(val1, val2, val3, na.rm = T)
  ) 

FileSystemDataset (query)
city: string
val1: double
val2: double
val3: double
max_val_1: double (element_wise_max(val1, val2, val3, {NON-REPRESENTABLE OPTIONS}))
max_val_2: double (element_wise_max(val1, val2, val3, {NON-REPRESENTABLE OPTIONS}))
min_val_1: double (element_wise_min(val1, val2, val3, {NON-REPRESENTABLE OPTIONS}))
min_val_2: double (element_wise_min(val1, val2, val3, {NON-REPRESENTABLE OPTIONS}))

See $.data for the source Arrow object

@asfimport
Copy link
Collaborator Author

Ian Cook / @ianmcook:
Issue resolved by pull request 10615
#10615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant