Something like
tbp <- as.numeric( gsub("(.*-)?([0-9]+)\\+?","\\2", Trade_Price_Band) )
would get you the numbers you want. The '500+' is then treated as 500, though.
One way of getting round that might be
tbp <- as.numeric( gsub("(.*-)?([0-9]+)","\\2", Trade_Price_Band) )
then
tbp[is.na(t
Hi,
#A lengthy solution for the simple problem.
#dat1 is the dataset
res<-unlist(lapply(strsplit(dat1[,1],split="-"),function(x) if(length(x)==1)
rep(x,2) else x))
res[seq(from=2,to=length(res),by=2)]
#or
gsub("[-]","",unlist(regmatches(dat1[,1],gregexpr("-.*|.*\\+",dat1[,1]
A.K.
- O
assuming you want more than just the first four rows
tpb <- read.table( text = " Trade_Price_Band x
1 0-30 0.6237240
2 101-150 0.6743857
3 151-200 0.6778513
4 201-300 0.6640293
5 301-400 0.6630991
6 31-50 0.6314547
7
3 matches
Mail list logo