Skip to content

Commit

Permalink
moving the taxa renaming routine to chkinp
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Butler authored and Robert Butler committed Mar 28, 2022
1 parent 8bed42b commit e6f9479
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ASCI
Type: Package
Title: Calculate scores for the Algal Stream Condition Index
Version: 2.5.0
Version: 2.5.1
Date: 2020-08-05
Description: Calculate ASCI scores using diatom, soft-bodied algae, or a
hybrid appproach. Scores are used for bioassessment of California perennial
Expand Down
14 changes: 0 additions & 14 deletions R/ASCI.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ ASCI <- function(taxa, stations){
txrmv <- dat$txrmv
dat <- dat$taxa

dat <- dat %>%
left_join(
taxa_crosswalk %>%
rename(FinalID = NewName)
,
by = 'FinalID'
) %>%
mutate(
FinalID = case_when(
is.na(OldName_in_ASCI_Calculator) ~ FinalID,
T ~ OldName_in_ASCI_Calculator
)
) %>%
select(-OldName_in_ASCI_Calculator)

# calculate GIS from stations
# calcgis calculates required gismetrics which are not provided, from the ones that were provided in the station data
Expand Down
17 changes: 17 additions & 0 deletions R/chkinp.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ chkinp <- function(taxa, station, getval = FALSE){
stop(msg, call. = FALSE)
}

taxa <- taxa %>%
left_join(
taxa_crosswalk %>%
rename(FinalID = NewName)
,
by = 'FinalID'
) %>%
mutate(
FinalID = case_when(
is.na(OldName_in_ASCI_Calculator) ~ FinalID,
T ~ OldName_in_ASCI_Calculator
)
) %>%
select(-OldName_in_ASCI_Calculator)



# Reassure that all columns are the correct datatype
taxa <- taxa %>%
dplyr::mutate(
Expand Down

0 comments on commit e6f9479

Please sign in to comment.