Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df <-
- data.frame(B=c(1,0,0),
- C=c(3,4,9),
- D=c(1,1,0))
- #A function to calculate stations whether there is a communication or process component or both
- df <- df %>%
- mutate(combined.score = ifelse("B" %in% names(.) & "C" %in% names(.) & "D" %in% names(.), B + C + D,
- ifelse("B" %in% names(.) & "C" %in% names(.), B + C,
- B))) %>%
- mutate(combined.score.correct = B + C + D)
- [1] TRUE
Add Comment
Please, Sign In to add comment