[未知用户] hi, 邱怡轩,
Yes, i have, i have successfully loaded shx file of Australian map:
Yes, i have, i have successfully loaded shx file of Australian map:
> getColor=function(mapdata,provname,provcol,othercol) + { + f=function(x,y) ifelse(x %in% y,which(y==x),0); + colIndex=sapply(mapdata$att.data$NAME,f,provname); + col=c(othercol,provcol)[colIndex+1]; + return(col); + } > > > provname=c("Canberra") > provcol=c("red") > plot(ozDATA,col=getColor(ozDATA,provname,provcol,"White")) Error in colIndex + 1 : non-numeric argument to binary operatorsee the Error msg above, why is that?