I have two separate dataframe, one (frame1) has the general info about the location of sensors and the other one (frame2) has the time series for all the locations with the siteIDs column common between the two.
I want to add another column to frame2. I thought it would be possible to use lapply, but it is not working. I have also tried using [[ instead of $, no gain. It does not produce any warning or error. It simply does not do anything.
gaugeList<-as.list(unique(frame2$siteIDs))
frame2[['timeZone']]<-as.character(NA)
lapply(gaugeList,function(gaugeX) { frame2$timeZone[which(frame2$siteIDs==gaugeX)] <- (as.character(frame1$timeZone[which (frame1$siteIDs==gaugeX)]))})