[R] Joining data frames
Jeff Newmiller
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Tue Jun 29 17:34:08 CEST 2021
1) Compare the text below that the mailing list sent us to what you saw when you sent your post... this occurred because you did not follow the instructions in the Posting Guide that tell you to send plain text email... the mailing list strips formatting. Note that there are far too many email clients for the Posting Guide to provide instructions on how to configure your particular email client to send plain text, but it is always an option.
2) `right_join` is not a base R function, so you should be specifying which contributed package it comes from.
3) If it comes from dplyr, then you should take note that right_join is not actually used very often in practice. Have you tried left_join?
On June 29, 2021 8:12:28 AM PDT, Esthi Erickson <ericksonesthi using gmail.com> wrote:
>Hi and thank you in advance,
>
>If I have a dataframe, df:
>
>Sample
>
>Plot
>
>Biomass
>
>1
>
>1
>
>1024
>
>1
>
>2
>
>32
>
>2
>
>3
>
>223
>
>2
>
>4
>
>456
>
>3
>
>1
>
>
>3
>
>2
>
>331
>
>3
>
>3
>
>22151
>
>3
>
>4
>
>1441
>
>And another one, df1:
>
>Sample
>
>Plot
>
>% cover of plant1
>
>% cover of plant2
>
>3
>
>1
>
>32
>
>63
>
>3
>
>2
>
>3
>
>
>3
>
>3
>
>
>3
>
>3
>
>4
>
>5
>
>23
>
>I want to join these tables where the columns Sample and Plot are the
>same.
>
>Currently trying:
>
>df<- right_join(df, df1, by = c(“Sample”, "Plot"))
>
>I am working with a much larger dataset, but it will cut off the data
>starting at Sample 3 instead of joining the tables while retaining the
>information from df. Any ideas how I could join them this way?
>
>
>Esthi
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.
--
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list