Created
July 26, 2015 13:36
-
-
Save decisionstats/af31610f53f220f06a6c to your computer and use it in GitHub Desktop.
data strings in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| names2<-c("Ajay","Vijay","Rajesh","Arinjay","Ram") | |
| gsub("jay","Ohjay",names2) | |
| names3=toupper(names2) | |
| names3 | |
| grepl("jay",names3) | |
| library(stringr) | |
| names4=str_to_upper(names2) | |
| names4 | |
| money=c("$50000","50,000",50000) | |
| money2=gsub(",","",money) | |
| money2 | |
| money3=gsub("\\$","",money2) | |
| money3 | |
| money4=as.numeric(money3) | |
| money4 | |
| names2 | |
| names3 | |
| paste(names2,names3) | |
| #names5=as.character(names2) | |
| substr(names2,2,5) | |
| names2 | |
| nchar(names2) | |
| substr(names2,nchar(names2)-2,nchar(names2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment