I have the following data frame (below), which is a subset of my complete data set. I need to define the same identifier for each record with the same LAT / LONG and landing date. I previously ordered LANDEDDATE from the earliest and latest dates.
> dput(df2) structure(list(LATITUDE = c(43.35, 43.35, 43.35, 43.35, 43.35, 43.35, 43.35, 43.35, 43.5166, 43.5166, 43.5166, 43.5166, 43.5166, 43.5166, 43.5166, 42.9833, 42.9833, 42.9833, 42.9666, 42.9666 ), LONGITUDE = c(-60.6163, -60.6165, -60.7167, -60.7166, -60.7163, -60.716, -60.7169, -60.7166, -59.9169, -59.9168, -59.9169, -59.9166, -59.9166, -59.916, -59.916, -61.8333, -61.8333, -61.8333, -61.9161, -61.9161), LANDEDDATE = structure(c(11171, 11171, 11183, 11183, 11183, 11183, 11183, 11183, 11192, 11192, 11192, 11192, 11192, 11192, 11192, 11210, 11210, 11210, 11210, 11210), class = "Date"), sppCODE = c(251L, 251L, 251L, 251L, 251L, 251L, 251L, 251L, 251L, 251L, 251L, 251L, 251L, 256L, 251L, 256L, 252L, 251L, 251L, 252L), LIVEW = c(0.337, 0.471, 0.238, 0.772, 0.178, 0.416, 0.535, 0.356, 0.442, 0.663, 0.442, 0.497, 0.276, 0.032, 0.828, 0.035, 0.011, 1.224, 1.025, 0.072), SPECIES = structure(c(7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L), .Label = c("Albacore Tuna", "Bigeye Tuna", "Bluefin Tuna", "Mako", "Porbeagle", "Shark, UNSP", "Swordfish", "Tuna, UNSP", "White Marlin", "Yellowfin Tuna"), class = "factor")), .Names = c("LATITUDE", "LONGITUDE", "LANDEDDATE", "sppCODE", "LIVEW", "SPECIES"), row.names = c(19L, 20L, 13L, 14L, 15L, 16L, 17L, 18L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L), class = "data.frame")
This is what I have done so far, but I cannot understand the rest.
df2$setID<-"NA"
I need to assign the setID of my unique data frame to the corresponding sets (replicated with the same LAT / LONG and LANDEDDATE) in the rep data frame. Any advice would be appreciated!