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

Fix error related to filter(.testdata, spc > 100) #51

Open
GegznaV opened this issue Mar 27, 2022 · 4 comments
Open

Fix error related to filter(.testdata, spc > 100) #51

GegznaV opened this issue Mar 27, 2022 · 4 comments
Assignees

Comments

@GegznaV
Copy link
Member

GegznaV commented Mar 27, 2022

Code that worked previously now results in an error:

filter(.testdata, spc > 100)

May be related to the recent changes (up to 1-2 years) in Tidyverse.

@eoduniyi, please take care of this.

Related:

@eoduniyi
Copy link
Contributor

Code that worked previously now results in an error:

filter(.testdata, spc > 100)

May be related to the recent changes (up to 1-2 years) in Tidyverse.

@eoduniyi, please take care of this.

Related:

According to dplyr 1.0.8, filter() only allows matrices with a single column.

@eoduniyi
Copy link
Contributor

@GegznaV or @cbeleites could you please give some guidance on the default behavior of "filtering" the spectral matrix?:

Before the dplyr 1.0.8 update, filter(.testdata, spc > 100) would produce a hyperSpec object that would only keep the spectra whose intensity values were all > 100.

Alternatively, users could specify to keep the spectra if any of the spectrum's intensity were > 100

However, it's not clear to me where all_wl() or any_wl() is being applied in filter.hyperSpec()'s definition.

@eoduniyi
Copy link
Contributor

@GegznaV or @cbeleites could you please give some guidance on the default behavior of "filtering" the spectral matrix?:

Before the dplyr 1.0.8 update, filter(.testdata, spc > 100) would produce a hyperSpec object that would only keep the spectra whose intensity values were all > 100.

Alternatively, users could specify to keep the spectra if any of the spectrum's intensity were > 100

However, it's not clear to me where all_wl() or any_wl() is being applied in filter.hyperSpec()'s definition.

🤦🏿‍♂️ filter(.testdata, any_wl(spc > 100)) and filter(.testdata, all_wl(spc > 100)) work as expected.

@GegznaV
Copy link
Member Author

GegznaV commented Mar 31, 2022

In the Tidyverse, filter() keeps/removes rows based on provided conditions. The length of the logical vector that is created based on conditions should be equal to nrow(.data). So filter(.data, spc > 100) seems ambiguous to me, as the intensity at some wavelengths might fulfill the condition and at some others might not for the same row. So I'd also expect the failure when a condition such as spc > 100 is used.

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

2 participants