austraits icon indicating copy to clipboard operation
austraits copied to clipboard

Create `filter_column` function

Open ehwenk opened this issue 8 months ago • 0 comments

Context The extract and join functions act on the entire database, while any additional filtering of columns that a user might wish to perform need to be done on just the traits table. This means you need to first extract and join any information you want, then save the output as a tmp object, then start a new pip that performs additional filtering on tmp$traits. It would be nice if you could instead have a single pipe that extracts a particular collection of traits, taxa, and then also filters on other specified columns (i.e. life_stage, basis_of_record).

Describe the solution you'd like As an example:

my_data <- austraits %>%
  extract_trait("leaf_mass_per_area") %>%
  extract_taxa(genus = "Eucalyptus") %>%
  extract_column(column = "life_stage", value = "adult") %>%
  extract_column(column = "basis_of_record", value = "field") %>%
  join_locations() 

This would allow all manipulations to be linked in a single pipe -- and mean that if you join_contexts at the end, you'll only join the context properties that pertain to the filtered data.

Right now you have to use the join functions before you do any filtering just on the traits table (using filter).

ehwenk avatar Oct 17 '23 22:10 ehwenk