How can I save in one dataframe or in any other form outside the loop all my data?? I have bulk .nc files, I don't have problem getting the values or creating the data frame. The loop gives me 500 different d ( explanation, d=rbind(df, df.smos.s1)) but I would like to have one single file that will have all the information of the d.
Any idea??
df=NULL
files <- list.files(path="~/data", pattern="*.nc", full.names=T)
for (i in 1:length(files)){
nc <- open.nc(files[i])
nc_lon = var.get.nc(nc, "Longitude")
nc_lat=var.get.nc(nc, "Latitude")
nc_sm=var.get.nc(nc, "Soil_Moisture")
nc_tm=var.get.nc(nc, "Days")
df.smos.s1= data.frame(nc_lon,nc_lat,nc_sm,nc_tm)
d = rbind(df, df.smos.s1)
print(d) #500 times different .nc files
}