[R] Removing colon from numerical data
LCOG1
jroll at lcog.org
Thu Mar 4 18:12:09 CET 2010
Basic question, looked through the forum and documentation but didnt see a
solution.
So consider
O<-c(1:20)
D<-c("1:","2:","3:","4:","5:","6:","7:","8:","9:","10:","11:","12:","13:","14:","15:","16:",
"17:","18:","19:","20:")
Time<-c(51:70)
AveTT<-data.frame(O,D,Time)
I would like to remove the colon from the "D" column's data. This is how
the data is being given to me and its too big to put into excel to remove
the colons. I tried the below but neither returns what i want.
AveTT$D<-as.numeric(AveTT$D)
AveTT$D<-substr(AveTT$D,1,nchar(AveTT$D)-1)
so i want
O D Time
1 1 1: 51
2 2 2: 52
3 3 3: 53
4 4 4: 54
5 5 5: 55
6 6 6: 56
7 7 7: 57
8 8 8: 58
9 9 9: 59
10 10 10: 60
to become
O D Time
1 1 1 51
2 2 2 52
3 3 3 53
4 4 4 54
5 5 5 55
6 6 6 56
7 7 7 57
8 8 8 58
9 9 9 59
10 10 10 60
while maintaining the data's integrity. Thanks
JR
--
View this message in context: http://n4.nabble.com/Removing-colon-from-numerical-data-tp1578397p1578397.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list