Dear R-experts, I have got a dataframe: data ID disease V1 V2 1 p1 1 2 p1 3 3 p3 3 4 p3 5 5 p5 1 >From which I extract a usefull table: affect affect 1 3 5 p1 1 1 0 p3 0 1 1 p5 1 0 0
I want to merge this with anotherdataframe: age p1 23 p2 24 p3 23 p4 11 p5 45 If have tried as.data.frame(affect) and other solutions to get the following comment going: merge(age,affect, by.x=0, by.y=1) QUESTION: I can get the merging process going with the outcome of the table command. Any help would be great. R for windows v2.6.1 code: data<-as.data.frame(matrix(c("p1","p1","p3","p3","p5",1,3,3,5,1),5,2)) age<-as.data.frame(matrix(c("p1","p2","p3","p4","p5",23,24,23,11,45),5,2 )) affect<-table(data[,1],data[,2]) merge(age,affect, by.x=0, by.y=1) BW Marco [[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.