SHARE
TWEET

Untitled

a guest Jun 17th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name = c("company", "deriv.x", "isConfirmed.y")
  2. new.name = gsub(".x$|.y$", "", name)
  3. new.name
  4. [1] "compa"       "deriv"       "isConfirmed"
  5.      
  6. remove = c(".x", ".y")
  7. replace(name, name %in% remove, "")
  8. [1] "company"    "deriv.x"    "isConfirmed.y"
  9.      
  10. (.+?)(?:..+)?
  11.      
  12. gsub("(.+?)(?:\..+)?", "\1", "deriv.x")
  13.      
  14. name = c("company", "deriv.x", "isConfirmed.y")
  15. new.name = gsub("\.x$|\.y$", "", name)
  16. new.name
  17.  
  18. [1] "company"     "deriv"       "isConfirmed"
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