Landscape-Data-Commons / terradactyl

Tools for using terrestrial core methods data
Other
3 stars 4 forks source link

pct_cover automatically removes groupings that start or end with "Na" #46

Closed annack84 closed 3 years ago

annack84 commented 3 years ago

The pct_cover function filters out indicators for user grouping variables that start or end with "NA". For example, I included a nativity column in my species file (filled with either "Introduced" or "Native"), and pct_cover only gave me the indicators for the "Introduced" group.

Here's the existing code (lines 168 - 172): summary <- summary %>% subset(!grepl( x = indicator, pattern = "^[.]|[.]$|\.\.|\.NA|NA\.|\.NA\." ))

Here's a fix that worked for me: summary <- summary %>% subset(!grepl( x = indicator, pattern = "^[.]|[.]$|\.\.|\.NA$|^NA\.|\.NA\." ))

smccord commented 3 years ago

Thanks! Can you send me a copy of your species file?

On Wed, Aug 18, 2021 at 2:55 PM annack84 @.***> wrote:

The pct_cover function filters out indicators for user grouping variables that start or end with "NA". For example, I included a nativity column in my species file (filled with either "Introduced" or "Native"), and pct_cover only gave me the indicators for the "Introduced" group.

Here's the existing code (lines 168 - 172): summary <- summary %>% subset(!grepl( x = indicator, pattern = "^[.]|[.]$|..|.NA|NA.|.NA." ))

Here's a fix that worked for me: summary <- summary %>% subset(!grepl( x = indicator, pattern = "^[.]|[.]$|..|.NA$|^NA.|.NA." ))

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Landscape-Data-Commons/terradactyl/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADKRTCVA7YYHDPKCRWB3PHLT5QM4FANCNFSM5CM2TWOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

annack84 commented 3 years ago

Sure, here it is. I discovered this issue when trying to calculate percent cover with these grouping variables: PhotosyntheticPathway, Native, Duration, GrowthHabitSub. The results I got only included the "Introduced" indicators - "Native" indicators were excluded.

SpeciesList_SWEDD_Vernal_20210811.csv

smccord commented 3 years ago

Thanks! Fixed!