Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df <- data.frame("one"=c(1,2,3,4),"two"=c(4,NA,2,1))
- storeddate <- "Jan17-01-92"
- finaldf <- df %>%
- mutate(!!storeddate := one+two) %>%
- filter(!is.na(storeddate)) #the storeddate string call requires formatting as `Jan17-01-92` as opposed to "Jan17-01-92".
- finaldf <- df %>%
- mutate(!!storeddate := one+two) %>%
- filter(!is.na(!!storeddate))
- df %>%
- mutate(!!storeddate := one+two) %>%
- filter(!is.na(!!as.name(storeddate)))
- # one two Jan17-01-92
- # 1 1 4 5
- # 2 3 2 5
- # 3 4 1 5
Add Comment
Please, Sign In to add comment