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 401-500 0.6776249 8 500+ 0.6557705 9 51-75 0.6621073 10 76-100 0.6623469")
tpb[ , 1 ] <- gsub(".*-", "", tpb[ , 1 ] ) tpb On Wed, Dec 12, 2012 at 8:40 AM, Tammy Ma <metal_lical...@live.com> wrote: > > Hi, > > > I met this problem. > > 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 401-500 0.6776249 > 8 500+ 0.6557705 > 9 51-75 0.6621073 > 10 76-100 0.6623469 > > > I want to get the following matrix > > Trade_Price_Band x > 1 30 0.6237240 > 2 150 0.6743857 > 3 200 0.6778513 > 4 300 0.6640293 > > > how can I get this in r? > > > Thanks. > > Tammy > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.