Hi r-help-boun...@r-project.org napsal dne 12.11.2009 14:59:57:
> > Dear R helpers, > > Suppose I am reading a csv file as > > yd = read.csv("mydata.csv") > > The actual data in the mydata.csv file is say for example like this - > > > Date day_1 days_15 day_30 days_60 days_90 days_180 > Nov 11 5 14 1 > 3 21 8 > Nov 10 7 1 > 3 11 5 14 > Nov 09 2 10 3 > 6 4 2 > ........ > ........ > > and so on. > While I have done all the related analysis, > > (1) how do I read > > maturity <- c(1, 15, 30, 60, 90, 180) # these are the part of column > names in numeric class. > > i.e. I want the no of days appearing in column name heads to be expressed like this. > I had similar problem some time ago. Chuck Taylor helped me with this and I suppose you can use it too x<-names(yd) maturity <- substring(x, regexpr("[0-9]+$", x)) > (2) Also, how do select the subset of maturity e.g. > > maturity_sub <- c(30, 60, 90) use maturity[maturity>15] regards Petr > > > Thanking you all in advance > > > Regards > > > Julia > > ************************************************ > > Only a man of Worth sees Worth in other men > > ************************************************ > > > > [[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. ______________________________________________ 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.