[R] Merging Issue

Farnoosh Sheikhi farnoosh_81 at yahoo.com
Sat Jun 18 02:33:11 CEST 2016


Hi all, 
I have two data sets similar like below and wanted to merge them with variable "deps". As this is a sample data with small sample size, I don't have any problem using command merge. However, the actual data set has ~60,000 observations with a lot of repeated measures. For example, for a given ID I have 100 different dates and groups. Thee problem is using "merge" command gives me a lot of duplicates that I can't even track. I was wondering if there is any other way to merge such a data.Any help is appreciated. Thanks.
## Data ASubject<- c("2", "2", "2", "3", "3", "3", "4", "4", "5", "5", "5", "5")dates<-seq(as.Date('2011-01-01'),as.Date('2011-01-12'),by = 1) deps<-c("A", "B", "C", "C", "D", "A", "F", "G", "A", "F", "A", "D")df <- data.frame(Subject, dates, deps)
## Data Bloc<-c("CA","NY", "CA", "NY", "WA", "WA")grp<-c("DE", "OC", "DE", "OT", "DE", "OC")deps<-c("A","B","C", "D", "F","G")df2<-data.frame(loc, grp, deps )
dat<-merge(df, df2, by="deps")
 


	[[alternative HTML version deleted]]



More information about the R-help mailing list