Guest User

Untitled

a guest
Jan 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. library(dplyr)
  2. library(magrittr)
  3. set.seed(234)
  4. df<-data.frame(ano=sample(2011:2015,7,TRUE),mes=sample(1:12,7,TRUE),semana=sample(1:5,7,TRUE), vlcasa=sample(100:1000,7,TRUE),vlcarro=sample(1:100,7,TRUE))
  5.  
  6. df %<>%
  7. mutate(vlcasa=case_when(
  8. .$ano == 2011 & .$mes == 8 & .$semana== 2 ~ 200,
  9. TRUE ~ as.numeric(as.character(.$vlcasa))
  10. ),
  11. vlcarro=case_when(
  12. .$ano == 2011 & .$mes == 8 & .$semana == 2 ~ 9,
  13. TRUE ~ as.numeric(as.character(.$vlcarro))
  14. )
  15. )
Add Comment
Please, Sign In to add comment