If you really want to work with character strings, you could do something like data.s1 <- data$date[grep(".*-Sep-.*", date)]
(see ?regexp for more on pattern matching) but there are better ways to handle dates. You should convert the character strings into Date objects: see ?Date. And check out the zoo package. -Felix On Thu, Jul 24, 2008 at 8:30 PM, Williams, Robin <[EMAIL PROTECTED]> wrote: > Hi all, > Is there an equivalent to the general * operator in R, where * can > represent any character? > I have a dataset, one column being date, date ranging between > April-September, 97-06. I would like to be able to acquire the data for > a specific month, say September, so that I can take average temperatures > for the month, etc. I thought I would be able to do something like > data.s1 <- subset(data,date=="**-Sep-**") > data.s1 > but when I do > data.s1 > I get "0 rows or 0-length row.names". > Any idea of a simple way I can perform this task? > All dates are in the form xx-xxx-xx, EG 30-Sep-06. > Thanks for any assistance. > > > Robin Williams > Met Office summer intern - Health Forecasting > [EMAIL PROTECTED] > > > > [[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. > -- Felix Andrews / 安福立 PhD candidate Integrated Catchment Assessment and Management Centre The Fenner School of Environment and Society The Australian National University (Building 48A), ACT 0200 Beijing Bag, Locked Bag 40, Kingston ACT 2604 http://www.neurofractal.org/felix/ 3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8 ______________________________________________ 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.