Guest User

Untitled

a guest
Jan 16th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. df <-
  2. data.frame(B=c(1,0,0),
  3. C=c(3,4,9),
  4. D=c(1,1,0))
  5.  
  6. #A function to calculate stations whether there is a communication or process component or both
  7. df <- df %>%
  8. mutate(combined.score = ifelse("B" %in% names(.) & "C" %in% names(.) & "D" %in% names(.), B + C + D,
  9. ifelse("B" %in% names(.) & "C" %in% names(.), B + C,
  10. B))) %>%
  11. mutate(combined.score.correct = B + C + D)
  12.  
  13. [1] TRUE
Add Comment
Please, Sign In to add comment