Skip to content

Commit e6f9479

Browse files
Robert ButlerRobert Butler
authored andcommitted
moving the taxa renaming routine to chkinp
1 parent 8bed42b commit e6f9479

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: ASCI
22
Type: Package
33
Title: Calculate scores for the Algal Stream Condition Index
4-
Version: 2.5.0
4+
Version: 2.5.1
55
Date: 2020-08-05
66
Description: Calculate ASCI scores using diatom, soft-bodied algae, or a
77
hybrid appproach. Scores are used for bioassessment of California perennial

R/ASCI.R

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,6 @@ ASCI <- function(taxa, stations){
4444
txrmv <- dat$txrmv
4545
dat <- dat$taxa
4646

47-
dat <- dat %>%
48-
left_join(
49-
taxa_crosswalk %>%
50-
rename(FinalID = NewName)
51-
,
52-
by = 'FinalID'
53-
) %>%
54-
mutate(
55-
FinalID = case_when(
56-
is.na(OldName_in_ASCI_Calculator) ~ FinalID,
57-
T ~ OldName_in_ASCI_Calculator
58-
)
59-
) %>%
60-
select(-OldName_in_ASCI_Calculator)
6147

6248
# calculate GIS from stations
6349
# calcgis calculates required gismetrics which are not provided, from the ones that were provided in the station data

R/chkinp.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,23 @@ chkinp <- function(taxa, station, getval = FALSE){
105105
stop(msg, call. = FALSE)
106106
}
107107

108+
taxa <- taxa %>%
109+
left_join(
110+
taxa_crosswalk %>%
111+
rename(FinalID = NewName)
112+
,
113+
by = 'FinalID'
114+
) %>%
115+
mutate(
116+
FinalID = case_when(
117+
is.na(OldName_in_ASCI_Calculator) ~ FinalID,
118+
T ~ OldName_in_ASCI_Calculator
119+
)
120+
) %>%
121+
select(-OldName_in_ASCI_Calculator)
122+
123+
124+
108125
# Reassure that all columns are the correct datatype
109126
taxa <- taxa %>%
110127
dplyr::mutate(

0 commit comments

Comments
 (0)