0

I have two data frames with separate information, but are related by the PLOT column. In this column, the identifier for a plot is listed (i.e. both data frames have "HI 2").

  • The first data frame, data.csv, contains GPS coordinates for each PLOT.
  • The second has eelgrass shoot density.

My question is how can I merge these so that both the GPS coordinates and eelgrass shot density are together in a single data frame?

An example of what each data frame looks like:

head(data)

PLOT SIZE EAST NORTH
HI 1 1.0 435500.0 4140520
HI 2 0.5 435650.0 4140520

head(density)

PLOT SIZE DENSITY SEEDYR
HI 2 1.0 50 2006
HI 5 0.5 100 2006

So, I need to merge it so that it knows HI2 should have a single line with EAST, NORTH, and DENSITY all merged together. There are a fair few more lines, some that match and some that don't (i.e. HI 1 and HI 5).

Thank you!

Parfait
  • 97,543
  • 17
  • 91
  • 116
jammin
  • 9
  • 2
  • `dplyr::left_join(data, density, by = "PLOT")` assuming you want all rows in `data` but not necessarily unmatched rows in `density`. – dash2 Nov 30 '21 at 21:49

0 Answers0