Questions tagged [r]

Statistical computing language and software environment.

615 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
1k views

Combining multiple netcdf in folder in R

I have a folder that contains 61 netcdf files containing 4 dimension (lat, lon, time and depth) and 9 variables. I would like to combine all the files in the folder to one netcdf file with the ...
2
votes
0answers
297 views

Identifying activity places in GPS trajectories using R?

Is there a way in R (a script or package) that would allow identifying activity spots in GPS tracking data? I have a number of GPS tracks in GPX/CSV formats that follow the movements of people in a ...
2
votes
0answers
403 views

RQGIS R package to use QGIS functions is not working: throwing Error, UnicodeEncodeError / Python?

I am currently using R ver. 3.4.1 installed on C:\R\R-3.4.1, installed and loaded Packages: RQGIS, sp, raster. QGIS ver. 2.18.11 installed with OSGeo installer on C:\OSGeo4W64\apps\qgis. In R I am ...
2
votes
0answers
655 views

Group and aggregate SpatialPolygonsDataFrame by column in R

I'm working with rgdal, sp, maptools, etc. I have a SpatialPolygonsDataFrame that has each row/Polygons list with only one Polygon. It also has an identifier column which I want to use to group by, ...
2
votes
0answers
504 views

Using R + Google Earth

I'm using emissions data in the form of netCDF files from the CMIP5 project. I've loaded this data into R as a rasterBrick and can see that it has 6 layers. My goal is to be able to use this data ...
2
votes
0answers
3k views

Error in compareRaster(c(x, rasters)) : different extent

I have a RasterStack that I want to add two rasters to. I am using this code library(rgdal) library(raster) #original rasterstack rasterfiles <- list.files("C:\\path_to_rasters", "*.tif$", ...
2
votes
0answers
230 views

R: discrepencies between pointDistance and costDistance

I'm trying to do some landscape analyses using R, and am having issues where using the pointDistance function from the raster package and the costDistance function from the gDistance package can give ...
2
votes
0answers
580 views

Download HDF NDVI in R

I have a function to automate downloading NDVI data from https://e4ftl01.cr.usgs.gov/MOLT/ However, I'm hitting an error when downloading the .HDF files. They download fine but they seem to be ...
2
votes
0answers
164 views

Read JPEG2000 in R for subsequent random forest classification

I want to use random forests in R to classify an image. My image is in jp2 format. I read Open JPEG2000 (Sentinel 2) in R and updated my rdal: rgdal: version: 1.2-5, (SVN revision 648) Geospatial ...
2
votes
0answers
187 views

Alignment, raster time-series, R

I have a Landsat raster time-series (2000-2016) of 102 rasters for the same location. Since the original Landsat scenes don't overlap exactly, I defined a polygon to use for cropping all the rasters ...
2
votes
0answers
158 views

Multiple dimensions problem in importing kml files

When I import multiple kml files into R by using readOGR in a loop, I came across the problem denotes as follows Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = ...
2
votes
0answers
375 views

Removing spatial autocorrelation (SAC) using Moran's Eigenvectors and predict distribution?

I successfully managed to incorporate moran's eigenvectors as predictor to my species distribution model using GLM (logit). I followed Dormann et al. (2007) and the appendix. I think I got corrected ...
2
votes
0answers
242 views

Joining overlapping polygons in R?

I have two shapefiles with polygons (say S1 and S2). Some of the polygons are overlapping in the two shapefiles but not perfectly. In addition some polygons from S1 are touching polygons from S2. I ...
2
votes
0answers
127 views

How to extract information from a tiff through the use of a shapefile?

I am having trouble in using the data from the South America amazon from a shapefile. What I was asked to do was to take the data from the loss of forest in a format where it is possible to make sense ...
2
votes
0answers
401 views

Reading TIGER/Line gdb file into R

I am using the following instructions to read a TIGER/Line gdb into R. The first commands work correctly and print out the feature classes: fgdb <- "ACS_2014_5YR_BG_48_TEXAS.gdb" subset(...
2
votes
0answers
105 views

How to check whether two raster (RasterBrick) objects show the same trend in R (how to apply spatial testing)?

I have two RasterBrick objects in R! Both RasterBrick objects describes the same area and the same time periods. Each raster in RasterBrick stores values for one specific month. I would like to test ...
2
votes
0answers
92 views

R raster rasterToPolygon Error

I'm trying to convert a RasterBrick to polygon, across four different resolutions. It works for the coarsest three resolutions, but for the finest resolution, I get an error that I can't find much ...
2
votes
1answer
87 views

Selecting nearby polygons in QGIS?

I am working with QGIS and I have two different polygons, one with municipalities and another with conservation units (from Brazil). I need find out which Conservation units falls within 50 km from ...
2
votes
0answers
112 views

SpatialPolygonsDataFrame chloroplethr not writing to KML for GoogleMaps using R

I'm trying to do a simple chloropleth map for postal codes. I have the orginal kml exported here. When importing into R, i'm doing: library(rgdal) library(rworldmap) library(plotKML) library(...
2
votes
0answers
93 views

Railways usage - How to assign values to part of existing lines?

I am conducting a project about rail accessibility/capacity, working with railways/stations downloaded in R with Overpass. Manually I computed the number of trains for each lines and I would like to ...
2
votes
0answers
121 views

Calculate probability of occurrence from multiple grids

I generate a lot of spatial grid files and I want to calculate the probability that a certain threshold isn't exceeded. In this example here I want to see what's the probability of each cell that the ...
2
votes
0answers
1k views

How to use WMS in R?

I like to implement a special WMS-layer with leaflet() in R. But I have no success with the WMS-layer I like to use. library("leaflet") library("sp") # this example from the tutorial works leaflet() ...
2
votes
0answers
400 views

Converting .adf raster from UTM to lat/long without UTM zones in R

I have an .adf file that I have opened in R with the raster package. It's data on the saturation levels of Aragonite on a global scale. When I plot the raster it looks okay. But I need the data in ...
2
votes
0answers
171 views

How to find peaks by comparing with neigbhour points

I have a raster layer with 3 bands band1 - elevation data band2 - x-coord band3 - y-coord I want to run  a grid of 9*9 cells over this raster layer staring from top-left to bottom-right row-wise ...
2
votes
0answers
80 views

Simple mathematical operations using R script in QGIS

I have used several interpolation methods to create digital elevation models from a trainings data set. Now, I would like to assess the quality of each DEM by calculating the Root mean square error ...
2
votes
0answers
308 views

gstat's krige.cv() error: “Error: dimensions do not match:”

I am using krige.cv() for cross validation of a data set with 1394 locations. In my code, empirical variogram estimation, model fitting, and kriging (by krige()) everything works fine. But when I use ...
2
votes
0answers
38 views

Convert lat/lon points to gridded panel dataset?

Suppose I had a dataset that looked like df. Could someone show me how I would I summarize this panel dataset into a panel by km x km grids in R? df <- expand.grid(decade = seq(1940, 2010, 10), ...
2
votes
0answers
419 views

R code for Kernel Density Estimation

During the process of doing kernel density in R, using UK crime data as data set. Below is the work I have done so far but encounter some issues: library(ks) library(raster) data1<-subset(data,...
2
votes
0answers
101 views

Error when running v.krige

I've been trying to get v.krige to run in the Grass7 command line, however, when I do so I get the following error: Error : .onAttach failed in attachNamespace() for 'rgrass7', details: call: if (...
2
votes
0answers
392 views

What's the relationship between NetCDF dataset and ncdf4 class in R

I want to process ERA reanalysis data in R so I install RNetCDF package and ncdf4 package.When I open my reanalysis file using open.nc() and nc_open() functions separately in two packages, I found my ...
2
votes
0answers
349 views

How to download GPM rainfall data automatically?

How to download GPM rainfall data automatically? I tried to use DownloadGPM.R Function, but I think I had problem with Axel download accelerator. I guess I need to declare Axel as environment ...
2
votes
0answers
233 views

Kernel Density with vector output and/or possible automation?

I'm currently working on a project that will have me calculate the kernel density of a number of shapefiles with varying parameters. My current workflow goes like this: Import shapefiles in QGIS 2.10....
2
votes
0answers
152 views

TryCatch for if two extents?

I have some spatial processing in R that I want to do. After selecting out the appropriate polygon (clip1) I want to crop the raster on that polygon with the command clip1 <- crop(imported_raster, ...
2
votes
0answers
285 views

Filtering Small Areas of Shapefiles Using R

I'm trying to use the method proposed by the @ialm in the Question "How to speed up the plotting of polygons in R?" There, he loads the maps using getData from the raster package, I tested and it ...
2
votes
0answers
384 views

Find Maximum value per month in rasterstack/brick and corresponding timestamp R

When dealing with raster images, I found the raster and rts packages in R to be very flexible for analysing my raster data unlike ArcGIS. In my learning efforts, I have had to do some stacking/...
2
votes
0answers
467 views

Is there an R package for finding the maximum-area rectangle in a non-convex polygon?

Does anyone know if there is an R package out there with an algorithm which finds the largest rectangle within non-convex polygons? I have Googled, searched the R Sig Geo archives, and looked here on ...
2
votes
0answers
247 views

non-finite value supplied by optim when I use estiStAni or fit.StVariogram

I have computed an empirical spatio-temporal variogram and I want to fit it into a model I built using vgmST. However, whenever I call fit.StVariogram I get the error "non-finite value supplied by ...
2
votes
0answers
2k views

Extract values from Rasters in R based on spatial points and spatial polygons

I am trying to extract values from a raster file using the extract command in R mentioned here: http://www.inside-r.org/packages/cran/raster/docs/extract My raster file is unprojected (WGS84 ...
2
votes
0answers
80 views

Converting u and v from WGS84 to NZTM2000 - Do I need to do vector conversion?

I have u and v wind component values in latitude and longitude in WGS84. I want to convert this to NZTM2000. I've converted the lat/lon in ArcView - (and will try in R) - but do I need to also do some ...
2
votes
0answers
603 views

Adding a custom color scale for a sp.points layer to levelplot() legend

I'm wondering how I can add a customized color palette that I used to display a sp.points layer in a call to levelplot (lattice plotting) in the rasterVis package in R. I used a function that Dave X ...
2
votes
0answers
760 views

Efficient way to resample, crop, and mask a raster image using R

Does anyone know an efficient way to resample an image? I am currently trying to crop a large image and clip two regions from a shapefile. From this clipped image, I would like to increase the pixel ...
2
votes
0answers
63 views

Clear QGIS plot results window

How do you clear old plots from the plots result window in QGIS? Is there a line of R code that you'd need to run to do so, or is there a means of doing so through the GUI?
2
votes
0answers
294 views

About shp for ggmap in the R

I am a new in R and GIS, so I kindly ask you on advice. I had a shp which I want to plot on google map. The shpfile is here: http://www.filedropper.com/exercisestanddata First I do this: ogrInfo(...
2
votes
0answers
373 views

R raster stack 4 dimensions

I am trying to create a raster stack / brick from a list of ncdf files with the dimensions 160x160x24x1). r = stack(files) This gives me a raster stack but without the 4th dimensions which is ...
2
votes
0answers
603 views

Delineate watershed using manual points in RSAGA

I'm currently trying for an automated solution to delineate watersheds within a large basin. I have a collection of locations (X,Y coords) for various tributaries reaching a larger river, and the end-...
2
votes
0answers
234 views

How to visualise change matrices over time

i've hit a bit of a tricky visualisation issue; I am quantifying some land use and land use change (LULUC) over a number of years. Typically, for data going from year to the next, a land change ...
2
votes
0answers
450 views

Raster memory usage in R

I am working with raster/brick data in R and running into memory issues. I am basically trying to use raster objects to perform some simple agent-based modeling, but the objects keep increasing in ...
2
votes
0answers
168 views

Merge Spatial polygons from shapefiles

I have downloaded the shapefiles from the following website: http://download.geofabrik.de/europe/france.html Each zip contains a "landuse" shapefile and I want to merge all of them in one single ...
2
votes
0answers
341 views

Get the intersection of two dataframes of coordinates R

I have two dataframes with geocodes. The first looks something like this: spoints<- data.frame(x=c(1,2,3,4,5,6),y=c(6,5,4,3,2,1)) spoints maps a country. My second data frame looks like this: ...
2
votes
0answers
311 views

From track+waypoints to elevation profile with waypoints

I have a track and waypoints (1) imported in QGIS. I want to calculate the closest point from every waypoint to the track (2). Then, I want a table with data that allows me to draw an elevation ...