So, I have a data frame that looks like this:
plot <- data.frame(plot=c("A", "A", "A", "B", "B", "C", "C", "C"),
grid= c(1,1,1,2,2,3,3,3),
year1=c(2000,2000,2010,2000,2010,2000,2010,2010),
year2=c(2005,2005,2015,2005,2015,2005,2015,2015))
plot
plot grid year1 year2
1 A 1 2000 2005
2 A 1 2000 2005
3 A 1 2010 2015
4 B 2 2000 2005
5 B 2 2010 2015
6 C 3 2000 2005
7 C 3 2010 2015
8 C 3 2010 2015
So for the plot column I have repeated values, the grid is always unique for each of the plots but the years are changing, what I want basically is a new data frame which will just keep all the unique combinations from these four columns, which would look like this:
plot grid year1 year2
1 A 1 2000 2005
2 A 1 2010 2015
3 B 2 2000 2005
4 B 2 2010 2015
5 C 3 2000 2005
6 C 3 2010 2015
I tried to look for solution but I could not fine anything that fits to my example.
unique(plot)?