Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. data(iris)
  2.  
  3. put_1 <- function(x){ x = 1}
  4.  
  5. iris %>%
  6. mutate_at(vars(Petal.Length, Petal.Width), funs(put_1)) %>%
  7. head()
  8. # Sepal.Length Sepal.Width Petal.Length Petal.Width Species
  9. # 1 5.1 3.5 1 1 setosa
  10. # 2 4.9 3.0 1 1 setosa
  11. # 3 4.7 3.2 1 1 setosa
  12. # 4 4.6 3.1 1 1 setosa
  13. # 5 5.0 3.6 1 1 setosa
  14. # 6 5.4 3.9 1 1 setosa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement