I have a matrix like so:
xy <- matrix(rnorm(128 * 64),128,64)
and I want to turn it to a raster in WGS84.
I also have a longitude and a latitude matrix:
with the following dimensions:
min(lon) <- 0 max(lon <- 357.1875 min(lat) <- -87.8638 max(lat) <- 87.8638
the latitude and longitude came for a netCDF, and for some reason the longitude is from 0 - 360 instead of -180 to 180, for now I am not worried about that though.
I try to create the raster like so:
r <- raster(xy, xmn = min(lon), xmx = max(lon), ymn = min(lat), ymx = max(lat), crs = CRS("+init=epsg:4326"))
but this returns: