I am trying to write a function to make a matrix of precipitation with this secuencie; ######## PRIMER PERIODO cordex1 <- nc_open("pr_CAM-44i_ICHEC-EC-EARTH_rcp45_r12i1p1_SMHI-RCA4_v1_mon_200601-201012.nc") fullmon1<-ncvar_get(cordex1,"pr") lat<-ncvar_get(cordex1,"lat", start=c(35.5),count=c(20)) lon <-ncvar_get(cordex1,"lon", start=c(125),count=c(21.5)) t <- ncvar_get(cordex1,"time") nlon <- dim(lon) nlat <- dim(lat) nt <- dim(t) fulldatav <- as.vector(fullmon1) fulldata <- matrix(fulldatav, nrow=nlon*nlat, ncol=nt) lonlat <- expand.grid(lon,lat) df_cordex1<- data.frame(lonlat,fulldata)
but with the expresion fulldata <- matrix(fulldatav, nrow=nlon*nlat, ncol=nt) this error appears Warning message: In matrix(fulldatav, nrow = nlon * nlat, ncol = nt) : data length [1378620] is not a sub-multiple or multiple of the number of rows [420] Somebody help me!!! [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.