This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 4th, 2013  |  syntax: None  |  size: 0.14 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. d <- data.frame(a = c("A_foo1", "B_foo2", " _foo3"))
  2.        
  3. a
  4. A
  5. B
  6. " "
  7.        
  8. a <- c("A_foo1", "B_foo2", " _foo3")
  9. gsub("_.*", "", a)
  10. #[1] "A" "B" " "
clone this paste RAW Paste Data