Uwe Ligges wrote: > > > Vincze Orsolya wrote: >> There are three columns, I was just careless. >> I succeed to merge the two tables. But: >> 1) in the first table there were rows, which were not present in the >> second >> table, these rows were deleted from the merged table too, but I need >> them. >> 2) If i want to import from the second table just a certain column, >> not all >> that is missing from the first, how can i do that? >> 3) How can I save the generated table? >> >> Sorry about the banal questions.... I'm beginner. >> And thanks for the help... >> Have a nice day > > > Homework? Then please ask you course material or teacher.
What makes you think that, Uwe? I don't see a teacher asking merge() questions to a rank beginner (I wouldn't). 1) look at the documentation: all.x=TRUE 2) use the usual subsetting mechanisms to work with only the relevant set of columns, e.g. merge(x, y[,c(1,2,6)], ....) 3) assign using z <- merge(x,y,....), then save() (or maybe write.table()) -pd >> >> 2009/2/15 Peter Dalgaard <p.dalga...@biostat.ku.dk> >> >>> Vincze Orsolya wrote: >>> >>>> Dear all,I had just started to learn R. So my question may sound a bit >>>> stupid for you. >>>> Is that possible to match and merge two tables in R? I mean I have two >>>> tables, in the first I have two columns: RING NUMBER, WEIGHT and >>>> CAPTURE >>>> >>> Err, ... for large values of "two"? Or is one of the three a rowname? >>> >>> DATE, in the second RING NUMBER, SEX and CAPTURE DATE. >>>> 1) First I want to see, if to the ring numbers are the same, the >>>> capture >>>> dates are too? >>>> 2) And second if ring numbers are the same, to import the sex from the >>>> second table in the first. >>>> >>>> Is that possible? >>>> >>> Yes. It's a job for merge() >>> >>> -- >>> O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B >>> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K >>> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 >>> ~~~~~~~~~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 >>> >> >> [[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. > > ______________________________________________ > 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. -- O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907 ______________________________________________ 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.