presagia-analytics / ctrialsgov

Query Data from ClinicalTrials.gov
https://presagia-analytics.github.io/ctrialsgov/
Other
13 stars 3 forks source link

filter_keywords() doesn't work for nested data.frame #5

Closed kaneplusplus closed 2 years ago

kaneplusplus commented 3 years ago

The filter_keywords() function does not work for nested data.frames. Is there a preferred way to filter trials based on interventions?

I added a function has_term() that can be used like the following:

studies %>% filter(map_lgl(interventions, ~ has_term(.x$name, "Pembrolizumab"))

for example to keep the trials where pembro appears as one of the interventions. Is there a better way to do this?

statsmaths commented 3 years ago

Good point, though I am not sure what you are referring to by the filter_keywords function. I think the method you have for searching the nested data frame is fine. Perhaps we could just wrap it inside ctgov_query as one of the query methods?