I am facing a problem in merging two datasets. I have given codes to the names which are common in both the datasets and also to those which are uncommon. When I gave gave the following command merge(df1,df2) only those rows and columns were merged which were having common codes. When I viewed the results, only common codes are seen and the remaining entries are not seen. Can anyone guide me in this regards? How should I merge these two datasets completely without loss of any information? Thanks, Shreyasee [[alternative HTML version deleted]]
Try using: merge(df1, df2, all = TRUE) On Wed, Aug 6, 2008 at 11:15 AM, Shreyasee Pradhan <shreyasee.pradhan at gmail.com> wrote:> I am facing a problem in merging two datasets. > I have given codes to the names which are common in both the datasets and > also to those which are uncommon. > When I gave gave the following command > > merge(df1,df2) > > only those rows and columns were merged which were having common codes. > When I viewed the results, only common codes are seen and the remaining > entries are not seen. > > Can anyone guide me in this regards? > How should I merge these two datasets completely without loss of any > information? > > Thanks, > Shreyasee > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
> merge(df1,df2,by=commonvar,all=T)Regards, Leandro Marino -----Mensagem original----- De: r-help-bounces em r-project.org [mailto:r-help-bounces em r-project.org]Em nome de Shreyasee Pradhan Enviada em: quarta-feira, 6 de agosto de 2008 11:15 Para: r-help em r-project.org Assunto: [R] Merging two datasets I am facing a problem in merging two datasets. I have given codes to the names which are common in both the datasets and also to those which are uncommon. When I gave gave the following command merge(df1,df2) only those rows and columns were merged which were having common codes. When I viewed the results, only common codes are seen and the remaining entries are not seen. Can anyone guide me in this regards? How should I merge these two datasets completely without loss of any information? Thanks, Shreyasee [[alternative HTML version deleted]] ______________________________________________ R-help em 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.