geospatial - Issue with coordinate projection for detecting spatial autocorrelation in R -


we have dataset contains latitude , longitude coordinates, attribute information, each in own separate column, stored numeric. these coordinates have been geocoded based on geographic coordinate system wgs 1984. know have significant spatial autocorrelation in our data, hoping visualize in bubble plot using “sp” package. modeling our example off of others online, such here: https://beckmw.wordpress.com/2013/01/07/breaking-the-rules-with-spatial-correlation/ . however, when try use coordinates command within "sp", keep getting error message:

code example: coords <- data.frame(lead$x, lead$y) coordinates(coords) <- c("lead6.x","lead6.y")

error in if (nchar(projargs) == 0) projargs <- as.character(na) missing value true/false needed

we can't load our direct code because it's sensitive , hosted on virtual environment without access internet. have ideas why might happening? we've looked proj4 package can't figure out how specify projection system (or error getting?). if knows of other packages in r or ways visualize spatial autocorrelation, appreciated too.

your code bit "strange": seems trying build dataset containing coordinates. afaiu, may need in line :

data <- data.frame(lead$x, lead$y, lead$z) 

,with lead$z corresponding generic "variable" want inspect,

coordinates(data) <- c('x','y')` proj4string(data) <- "+init=epsg:4326" 

, should give proper "spatialpointsdataframe" lat-lon wgs84 geographic coordinates (the first line dropped, , you'll keep variables in data of spatialpointsdataframe).

hth


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -