Dear list:

I ask for your help in a simple problem in which I'm not figuring out
the solution

My data looks like:
dat<- data.frame(date=c("12/12/1980", "03/11/1994", "15/11/1999",
"31/10/2000", "20/03/2007", "05/01/2001"), 
var1=c("A", "A", "B", "D", "C", "A"), var2=runif(6))

I was wondering if I could split the column "date" in 3 new columns in 
he data frame corresponding to "day", "month" and "year".


If I decide not to split the date in 3 columns, I'd do:

dat$date<- as.Date(dat$date, "%d/%m/%Y")

Now, how can I subset parts of the dataframe, lets say for a given month
and year, something like
subset(dat, date=="1999-11-??")
The "??" is obviously wrong. How should I do this?

Many thanks
-- 
  
  [EMAIL PROTECTED]

-- 

______________________________________________
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.

Reply via email to