问题
I am using following code for opening a Raster image in single band (with temperature values)-
library(raster)
nrows = 764
ncols = 1022
df1 <- read.table("AA092800_1.asc", skip = 11, header = FALSE, sep = "\t", dec = ",")
r.mat <- matrix(data = "df1", nrow = nrows, ncol = ncols)
r <- raster(r.mat)
extent(r) <- extent(c(30,45.95,30,45.95))
res(r)
plot(r)
I am doing a silly mistake and the code is throwing the error-
"Error in setValues(r, as.vector(t(x))) : values must be numeric, integer, logical or factor"
The input Ascii file is attached.input Ascii file.
Please help.
来源:https://stackoverflow.com/questions/42087320/ascii-to-raster-conversion