SHARE
TWEET

Untitled

a guest Jun 18th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library('tibble')
  2.  
  3. df <- tibble(
  4.   ticker = c("first", "second", "third"),
  5.   status = c(T,T,T)
  6. )
  7.  
  8. > df
  9. # A tibble: 3 x 2
  10.   ticker status
  11.  1 first  TRUE  
  12.  2 second TRUE  
  13.  3 third  TRUE
  14.      
  15. library('dplyr')
  16.  
  17. df %<>%
  18.   filter(ticker=='first') %>%
  19.   mutate(
  20.    status = F
  21.   )
  22.      
  23. > df
  24. # A tibble: 1 x 2
  25.   ticker status
  26. 1 first  FALSE
  27.      
  28. > df
  29. # A tibble: 3 x 2
  30.   ticker status
  31. 1 first  FALSE
  32. 2 second TRUE  
  33. 3 third  TRUE
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top