I need to make a fusion of raster images with terra and aqua satellites of modis in R. To carry out the cycle I must have the same length of the satellite vectors, however for terra I have 6031 images and for aqua 5277. I do not know how to create a data.frame only with the images in common that share the day, and leave out those that are unique (without a partner).
library(raster)
library(MODIS)
setwd("C:/Composite")
#Directorio Terra
mypath1<-"C:/Reclass_MOD"
myras1<-list.files(path=mypath1,pattern = glob2rx("*.tif$"), ## nc es la extension de HDF
full.names = TRUE, recursive = TRUE)
name<-substr(myras8,16,31)
files1 <- stack(myras1)
date1<-extractDate(files1,asDate=TRUE,pos1=10,pos2=16,format= "%Y%j")
#Directorio Aqua
mypath2<-"C:/Reclass_MYD"
myras2<-list.files(path=mypath2,pattern = glob2rx("*.tif$"), ## nc es la extension de HDF
full.names = TRUE, recursive = TRUE)
name1<-substr(myras2,16,31)
files2 <- stack(myras2)
date2<-extractDate(files2,asDate=TRUE,pos1=10,pos2=16,format= "%Y%j")
> data.frame(date1$inputLayerDates,date2$inputLayerDates)
Error in data.frame(date1$inputLayerDates, date2$inputLayerDates) :
arguments imply differing number of rows: 6031, 5277