Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. df <- diamonds
  2. NewName <- "SomeName"
  3. df <- df %>% mutate_(paste0(NewName," = """))
  4.  
  5. Error: attempt to use zero-length variable name
  6.  
  7. df <- diamonds
  8. NewName <- "SomeName"
  9. df <- df %>% mutate_(.dots = setNames("paste('')",NewName))
  10.  
  11. df <- df %>% mutate_(.dots = setNames("paste(cut, color)",NewName))
  12.  
  13. carat cut color clarity depth table price x y z SomeName
  14. <dbl> <ord> <ord> <ord> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <chr>
  15. 1 0.23 Ideal E SI2 61.5 55 326 3.95 3.98 2.43 Ideal E
  16. 2 0.21 Premium E SI1 59.8 61 326 3.89 3.84 2.31 Premium E
  17. 3 0.23 Good E VS1 56.9 65 327 4.05 4.07 2.31 Good E
  18. 4 0.29 Premium I VS2 62.4 58 334 4.20 4.23 2.63 Premium I
  19. 5 0.31 Good J SI2 63.3 58 335 4.34 4.35 2.75 Good J
  20. 6 0.24 Very Good J VVS2 62.8 57 336 3.94 3.96 2.48 Very Good J
  21. 7 0.24 Very Good I VVS1 62.3 57 336 3.95 3.98 2.47 Very Good I
  22. 8 0.26 Very Good H SI1 61.9 55 337 4.07 4.11 2.53 Very Good H
  23. 9 0.22 Fair E VS2 65.1 61 337 3.87 3.78 2.49 Fair E
  24. 10 0.23 Very Good H VS1 59.4 61 338 4.00 4.05 2.39 Very Good H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement