Hi, I have two dataframes that I want to join. The first dataset has growth time series for two different sites, each site having two individuals. The second dataset has temperature time series for the two sites. I want to join both of these to have one table with climate and growth time series for each individual at each site. Here is a screenshot to show what I want my final joined data to look like.
I am guessing dplyr is the easiest way to go, but I am at a complete loss for how to do this. Thanks a lot for reading this and I'd appreciate any advice!
#growth data
#individuals from site one
site1ind1<-c(2,2.2,3.2,1)
site1ind2<-c(1,1.2,2.2,1.2)
#individuals from site two
site2ind1<-c(5,1,3.2,1)
site2ind2<-c(1,2,3,1.2)
df<-data.frame(site1ind1,site1ind2,site2ind1,site2ind2)
row.names(df)<-c(2000,2001,2002,2003)
#climate data
year<-c(2000,2001,2002,2003,2000,2001,2002,2003)
site<-c("site1","site1","site1","site1","site2","site2","site2","site2")
temp<-c(19,28,22,21,18,30,18,22)
climate<-data.frame(year,temp,site)