r <- raster(xmn=-150, xmx=-120, ymx=60, ymn=30, ncol=36, nrow=18)
r[] <- 1:ncell(r)
bb <- extent(-180, 0, 0, 90)
re <- expand(r, bb)
# expand with a number of rows and columns (at each side)
re2 <- expand(r, c(2,10))
Run the code above in your browser using DataLab