r - Creating a raster dataset but plot error -


l m learning r tool , l followed example although l did same ,l got error during the plot raster.

here code:

library(raster) library(rgdal)  myraster1 <- raster(nrow=4, ncol=4) myraster1[]<- 1:ncell(myraster1) myraster2=raster(nrow=8, ncol=8) resample(myraster1, myraster2, method='bilinear') plot(myraster2, main="raster 32 pixels") 

here error warnings:

error in .plotraster2(x, col = col, maxpixels = maxpixels, add = add,  :    no values associated rasterlayer 

how can l solve problem?

you need give name resampled raster:

library(raster) library(rgdal)  myraster1 <- raster(nrow=4, ncol=4) myraster1[]<- 1:ncell(myraster1) myraster2=raster(nrow=8, ncol=8) myraster1.resampled <- resample(myraster1, myraster2, method='bilinear') plot(myraster1.resampled, main="raster 32 pixels") 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -