Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

Statistical computing language and software environment.

6
votes
0answers
201 views

Packing squares polygons in a raster grid

In the green area of the raster I have to fit as many square polygons as possible, of three different sizes: 3x3 cell size 2x2 cell size 1x1 cell size With the fact that the approach should be ...
6
votes
0answers
717 views

Efficiently calculate distance between raster patch edges

I have a binary raster which I've classified into patches using raster::clump. I now want to efficiently calculate the edge-to-edge, i.e. minimum, pairwise distance between patches. I am currently ...
6
votes
0answers
2k views

How to prevent cross-world lines in ggplot world map?

I'm having issues displaying 'great circles' paths and polygons in ggmap, an extension of ggplot2. Please enter the following code to replicate my issues: https://gist.github.com/Robinlovelace/...
5
votes
0answers
312 views

Correctly handling climate projection data with R

EDIT: An example setup can be found here: The main file is extract_cordex.R I need to analyze climate data as part of my thesis, however I am not particularly trained in working with climate data and ...
5
votes
0answers
448 views

Cellular Automata Markov for forecast LULC in R software

I would like to forecast land use changes by implementing the Cellular Automata (CA) Markov Chain models in R software. I have the classified LULC maps from 3 times periods (1992,2003,2014), and also ...
5
votes
0answers
513 views

How to interpolate within defined boundaries of a deformed mesh using R?

My goal is to create an interpolation map of some output model results that are mapped on a deformed mesh (from a numerical simulation). The model results are in an x-y plane (representing coordinates)...
5
votes
0answers
391 views

Can extracting raster values work in polygons' CRS without raster resampling?

I am trying to extract raster values using polygon layer with different CRS. Raster is in WGS84 (EPSG:4326) and the polygons in UTM (EPSG:23031). 1. If I want to work in the projection of the ...
4
votes
0answers
441 views

Determining areas on a Voronoi Diagram around a point

I currently have two data sets concerning the Netherlands, one containing longitudes and latitudes of population cores (Hubs) along with other information, such as average house price, and the other ...
4
votes
0answers
2k views

Clipping raster brick object in R

I have MODIS NDVI TIFF files for a year I want to first clip it with a irregular polygon (not by its extent only) of my study area and save it as a multi band raster in TIFF format The TIFF image are ...
4
votes
0answers
834 views

Crop raster based on another raster R

library(raster) How can one clip one raster based on another raster? RasA: class : RasterLayer dimensions : 459, 533, 244647 (nrow, ncol, ncell) resolution : 10000, 10000 (x, y) extent ...
4
votes
0answers
494 views

Spatial weight matrix with boundary effects in R?

I need some help to finalize code for a spatial weight matrix that uses a nearest neighbor definition within regions, but does not allow neighbors from across a political border. For example, ...
4
votes
0answers
1k views

How to avoid “Unable to compute a transformation between pixel/line”?

I am trying to re-project from Equi-rectangular to the NASA global EASE grid (Equal Area Scalable Earth) grid 1383 586 with a ~25 km cylindrical projection (ESPG=3410). The file is provided as HDF5. ...
4
votes
0answers
694 views

Subset two rasters with different extent and origin (and resolution) only where there are data in both in R

in R, I have two rasters with different extents and origins (and possibly even resolution). How to efficiently take the subset of each of them only where there are data in both of them? Here is a ...
4
votes
0answers
204 views

How to set m parameter of clusterR function in R?

I want to manage a clustered computation on raster and thus use the "clusterR" function in R (package 'raster'). However, there's a tuning m parameter to set, but the only explanation about this ...
4
votes
0answers
1k views

Fortifying re-projected shapefile for ggplot2 in R

I have a shapefile of US county boundaries which I got from the NHGIS. I can load the file using the rgdal package and see information about it: library(rgdal) shp_1860 <- readOGR("shp", "...
3
votes
0answers
43 views

Test the relationship between two point patterns

I have two point patterns obtained from medical images. Points are used to represent cell markers. By visualization, the point pattern A is extremely possible to be a subset of point pattern B. So is ...
3
votes
0answers
22 views

Split a tmap legend and display in two locations

I would like to split the legend of a tmap object, so that one of the two elements is in the top left, and one in the top right. I have been through the documentation of tm_legend, but could not find ...
3
votes
0answers
56 views

Create foldable section in QGIS tool using R script

I am developping a GUI tool in QGIS using an R script and I am wondering how to add this kind of foldable section in the graphical interface.
3
votes
0answers
30 views

Calculate the length of shared boundaries between multiple polygons

I am trying to calculate the length of shared boundaries between multiple polygons in R. Specifically, I would like to calculate the shared boundary length of all the polygons in Census Place GIS data ...
3
votes
0answers
135 views

Difference in area calculation between QGIS and R

I used R to calculate the area of every land polygon of the world (Projection of the source shapefile: WGS84; CRS: EPGS: 4326). To do that, I loaded the required packages ("sp" and "raster") and I ...
3
votes
0answers
777 views

Fastest way to union a set of polygons in R

I want to find the fastest way to union a set of polygons into one large polygon. Lets first get some data: # Load libraries library('raster') library('geosphere') library('mapview') library(...
3
votes
0answers
36 views

smearing in Linux, but not in Windows

I must have a Linux library out of wack since the following image has "smears" on the colors. Is there a better term? On my Windows 7 RStudio it works fine. this image is from a Ubuntu 16.04 LTS ...
3
votes
0answers
418 views

Leaflet map in R Markdown - not rendering when placed after other plots

I have an R markdown document using shiny with 6 or 7 plots. They all display until the 7th plot, which is a leaflet map, which doesn't display - when I 'run document' there is a big empty space at ...
3
votes
0answers
224 views

Dealing with duplicate locations kriging - a method for replacing with a single location taking the mean of the duplicates? (R)

I understand that the existence of duplicate points (locations) when Kriging will result in a singular covariance matrix. The only way I've encountered people dealing with this is to keep the first of ...
3
votes
0answers
497 views

Using Random Forest for big data?

I used Random Forest regression for my work, but now I have another problem because I have really big data. I am using a VHR and this is much raster information. My script in R is this: rand.zero <...
3
votes
0answers
1k views

Clustering of events within a space-time window (R)

I am relatively new to clustering methods and am trying to determine the best method for clustering (or merely grouping) events that fall within a space-time window using preferably R. My goal is to ...
3
votes
0answers
75 views

Using euclidian distances as spacing for regular points grid in QGIS?

As a means of checking spatial autocorrelation in the selection of training samples for image classification, I am trying out semivariance analysis. I have managed to generate variograms from image ...
3
votes
0answers
688 views

Create a new NetCDF file combining information from two other NetCDF files in R

I wish to combine the "t" variable from the second .nc file, and use the lat, lon variables from the first .nc file as the lat and lon of the t variable, and store them to a new .nc file, that will ...
3
votes
0answers
404 views

ogr2ogr{gdalUtils} correct syntax to set Ground Control Points for vector georeferencing

I would like to know correct syntax of R {gdalUtils} package (version 2.0.1.7) to georeference Shapefiles using corner points as GCPs. (These Shapefiles have y=height and x=width information, without ...
3
votes
0answers
81 views

Data structure for analysis of relationship between rainfall and vegetation indices?

I have several hundred raster files (NDVI) of the same area dating back to the 1980’s, as well as daily rainfall observations from a nearby weather-station over the same period. The raster files are ...
3
votes
0answers
597 views

Failed to create a raster-brick from a netCDF file (.nc)

I am trying to build a raster-brick from a netCDF file (network Common Data Form) leave this link for more information () but to make a brick (which is part of the package raster) throws me the ...
3
votes
0answers
275 views

Keys for merging US state/county ANSI's with GADM Unique identifiers?

I've got county-level data from USDA NASS, and I want to merge it with gridded climate data. A preliminary step is the associate the counties with the coordinates of their centroids. If I merge by ...
3
votes
0answers
407 views

Doing spatial regression using big data when Spatial weight matrix is too large for R?

I am currently doing an analysis on a quite huge data set - 250,000 polygons. I have figured out the general Moran's I for a linear model, but when I was trying to do a spatial lag or spatial error ...
3
votes
0answers
823 views

How to Construct Spatio Temporal Clusters of Time Series Data in R

I have count data of one disease for various districts of a state of India on monthly basis. Is it possible to draw spatio temporal clusters in R? I have checked some R- packages for example ...
3
votes
0answers
373 views

Interpreting Global Moran's I and should I krig?

I am trying to weigh up if kriging (or cokriging) the residual error from my model is a valid approach. My first step was to compute whether the error is spatially autocorrelated. I have done this ...
3
votes
0answers
326 views

How to run GAM with raster package?

When I am using the raster package to predict a surface probability map of species distribution using the following functions in R, the following error occurrs: CA132122200=raster("F:/CBG maps-UnProj/...
3
votes
0answers
494 views

How to calculate 90% confidence interval in a raster stack

I have a stack of grid files (23) in ASC format from a MODIS sensor and I need to calculate a 90% confidence interval, mean, min, etc, for each one in R, how can I do that? specially the interval. #...
3
votes
0answers
339 views

R: Can raster predict function pass to predict.rfsrc (a prediction function in a parallel verion of RandomForest)?

It seems that raster predict function can pass to predict.randomForest by setting the "type='response'". I am using a parallel version of randomForest package called the "randomForestSRC" and I am ...
3
votes
0answers
232 views

R - how to create a pre-determined number of identical square polygons to use for a choropleth map?

I am trying to plot crime data density (again!) over a city map, say of NY. As a well known problem there are plenty of examples on this (http://www.obscureanalytics.com/2012/12/07/visualizing-...
3
votes
0answers
822 views

Decision tree classification of satellite image in R

I want to classify satellite image in R using RWeka classifier, J48. I have a CSV file with the classes required, and raster data loaded in R. I am able to make the tree, however, I am not able to use ...
3
votes
0answers
682 views

python equivalent of spatstat's spatial point process functions

Is there a free python package (i.e. PySAL?) that implements the standard summary statistics for spatial point processes, e.g. the F, G, J, and K functions? I'm happy to use R (i.e. spatstat) if ...
3
votes
0answers
399 views

How do I access layer attributes from within QGIS' manageR plugin?

This is probably a fairly basic question, but searches for manageR come up with a lot of noise, and there's no manageR tag. What I'd like to do is load the attributes from a particular field of a ...
2
votes
0answers
63 views

Plotting KML data on Leaflet map

I have 5 different KML files for each subzone of Singapore map. I want to plot the KML data by subzone on a Leaflet map. library(leaflet) library(raster) library(readxl) library(rgdal) setwd("F:\\...
2
votes
0answers
33 views

Biweekly time series for raster stack in r

I have a netcdf file with daily data and I calculate for each week some statistics, using the "apply.weekly" command in the "xts" library. However, I would like to calculate bi-weekly statistics, ...
2
votes
0answers
43 views

Merging two neighboring cells in grid of type SpatialPolygonsDataFrame?

I have a grid of type SpatialPolygonsDataFrame (each cell has a set of data attributes). I want to merge each cell which has a surface < X with one of its neighbours. An example is depicted in the ...
2
votes
0answers
59 views

All (GeoTIFF) raster values NA after converting to velox

Cross-posted to the velox GitHub repo: https://github.com/hunzikp/velox/issues/40 I'm able to extract average tree cover values for each of the three small counties in the US State of Delaware, but ...
2
votes
0answers
36 views

Detecting QGIS file lock

I tried using rgdal::writeOGR in R to overwrite a SHP file that was open in QGIS. Error in writeOGR(x, "C:/myFiles", "testFile", : Creation of output file failed Not only did it fail to ...
2
votes
0answers
28 views

Removing a 'non-gap' gap from a polygon that straddles +/- 180 longitude; looking for an R-based, code solution

I am working with a set of polygons from here: http://lme.edc.uri.edu/index.php/digital-data. In the artic, there are several polygons that straddle the +/- 180 longitude line. These are single ...
2
votes
0answers
56 views

Load images into a multi-band raster in R?

I have a Landsat image with 11 bands. I need to run k means classification in R. But I do not need the whole of the image as my study area is much smaller. So I have created shapefile of the Region of ...
2
votes
0answers
62 views

Generating flow path using r.drain from rgrass

I need to generate the flow path using r.drain from the rgrass7 package in RStudio. I am new to GRASS GIS and prefer to use the R package instead. I want to generate a flow path from a grid cell. ...