tidyomics / plyranges

A grammar of genomic data transformation
https://tidyomics.github.io/plyranges/
137 stars 19 forks source link

Selecting nonexistent columns prints confusing error message #99

Open mschubert opened 1 year ago

mschubert commented 1 year ago

Starting from your "Quick Overview" example (with plyranges=1.18.0),

library(plyranges)
df <- data.frame(start = 1:5, width = 5)
ir = as_iranges(df)

when I try to select a nonexistent column

ir %>% select(this_col_does_not_exist)

I get the error message:

Error in select_rng(.data, .drop_ranges, ...) : Cannot select/rename the following columns: start, end, width

This should probably print something like this instead:

Error in select_rng(.data, .drop_ranges, ...) : The following column does not exist: this_col_does_not_exist

This happens irrespective of using an IRanges or GRanges object.