Hi, Not sure if this is what you wanted: activity<- data.frame(Name=paste0("activity",LETTERS[1:5]),stringsAsFactors=FALSE) dates1<- data.frame(dat=as.Date(c("2013-02-01","2013-02-04","2013-02-05"),format="%Y-%m-%d")) merge(dates1,activity) # dat Name #1 2013-02-01 activityA #2 2013-02-04 activityA #3 2013-02-05 activityA #4 2013-02-01 activityB #5 2013-02-04 activityB #6 2013-02-05 activityB #7 2013-02-01 activityC #8 2013-02-04 activityC #9 2013-02-05 activityC #10 2013-02-01 activityD #11 2013-02-04 activityD #12 2013-02-05 activityD #13 2013-02-01 activityE #14 2013-02-04 activityE #15 2013-02-05 activityE
#or expand.grid(dat=dates1[,1],Name=activity[,1]) dat Name #1 2013-02-01 activityA #2 2013-02-04 activityA #3 2013-02-05 activityA #4 2013-02-01 activityB #5 2013-02-04 activityB #6 2013-02-05 activityB #7 2013-02-01 activityC #8 2013-02-04 activityC #9 2013-02-05 activityC #10 2013-02-01 activityD #11 2013-02-04 activityD #12 2013-02-05 activityD #13 2013-02-01 activityE #14 2013-02-04 activityE #15 2013-02-05 activityE A.K. ----- Original Message ----- From: ramoss <ramine.mossad...@finra.org> To: r-help@r-project.org Cc: Sent: Monday, April 1, 2013 11:54 AM Subject: [R] Data frame question Hello, I have 2 data frames: activity and dates. Activity contains a l variable listing all activities: activityA, activityB etc. The dates contain all the valid business dates. I need to combine the 2 so that I get a single data frame activitydat that contains the activity name along w/ evevry valid business dates such as Name dat activity A 2013-02-01 activity A 2013-02-04 activity A 2013-02-05 etc Any thought? Thanks ahead for your help. -- View this message in context: http://r.789695.n4.nabble.com/Data-frame-question-tp4662967.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.