Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
0
votes
0answers
90 views

Cannot extract cell values after reprojecting raster in R?

I've downloaded an 8-day composite (4x4km) of "chlorophyll a" for May 1, 2014. https://oceancolor.gsfc.nasa.gov/cgi/l3?per=8D&prd=CHL_chlor_a.nc&sen=A&res=4km&num=24&ctg=Standard&...
0
votes
1answer
2k views

Cutting leaflet map in R to a specific area

I am trying to cut a leaflet map in R, so I only show a specific municipality. I have manage to hide the remaining municipalities in the country, but that leaves the water and the rest of the world ...
0
votes
1answer
232 views

How to have a Raster output of a ppm model in spastat

I am trying to compare the outputs of species distribution models. My current code uses the following function to calculate TSS scores. TSS_Score<-function(TrueBinary, Raster) { Raster[]<-...
0
votes
1answer
516 views

Extract mean values of climate variables by level 2 administrative area country by country using R?

[Working with R version 3.2.2 in a Mac computer.] I am trying to calculate mean values for climatic variables (http://www.worldclim.org/) for spatial objects in R. The challenge is that I'm trying to ...
0
votes
0answers
376 views

Extracting information from Esri Grid Format (ADF) file using R?

I have an adf file that has a variety of "attribute" or field layers, and I am trying to extract one layer from that adf file, and convert it to a tiff image for further processing in python. Here is ...
0
votes
0answers
166 views

R memory issue with large polygon grid file

I have a 1 km by 1 km grid polygons for all of Ontario, Canada. This file is roughly 1 GB with 1116965 rows and can downloaded here: https://www.ontario.ca/data/utm-universal-transverse-mercator-1-km-...
0
votes
1answer
789 views

R: Self-intersection error when using intersect with two shapefiles

I am trying to "translate" worldwide raster data to European nuts3 polygons. That means I try to overlap two shapefiles to find the average value on nuts3 level. Unfortunately, when I use the ...
0
votes
1answer
849 views

Average and Annual rainfall in R? [closed]

I have rainfall data for more than 50 years in a column. I need to get total rainfall and average rainfall for each year. How can I do it in R?
0
votes
1answer
240 views

Extract boundary cells between classes from raster

I want to extract from a RasterLayer all boundary cells between classes (possibly according to the 4-cell rule), excluding from this operation cells that neighbour NA cells The raster::boundaries ...
0
votes
0answers
38 views

Recode 1 raster conditionally, based on many others

the basic premise is that I have 1 chief raster with values 55 to 75 and 6 rasters (A to F) which have all sorts of values between 1 and 15. If the chief raster has values (e.g.) 50 to 55, those ...
0
votes
0answers
206 views

import SpatialPolygonsDataFrame (SPDF) into PostgreSQL DB schema from R

This is a followup question to Writeogr to PostgreSQL/PostGIS database with R How can I choose the schema where to put the SPDF (or any other spatial object)? postgis_insert(con, df=catchments, tbl=...
0
votes
2answers
1k views

Creating prediction grid within certain boundary for surface interpolation in R?

I am trying to create a prediction grid within my boundary polygon. Firstly I need to make sure that my boundary shapefile is in UTM coordinates: NZGD <- CRS("+init = epsg: 2193") Load my ...
0
votes
1answer
167 views

R or ArcGis: average per polygon of the shortest distance to a river from each point in that polygon

All the shapefiles necessary can be found here. These are shapefiles of lakes, and rivers. Downloading one shapefile as an example should be enough to get me on the right track. The nuts file can be ...
0
votes
1answer
775 views

Convert SpatialPolygonsDF boundaries to SpatialLinesDF keeping information on polygons

I have a SpatialPolygonsDataFrame and I need to convert polygon boundaries into a SpatialLinesDataFrame retaining the attributes of the 2 polygons The structure of the SPDF looks like this 'data....
0
votes
1answer
64 views

Get value from list class (vector) in R [closed]

I have a simple question about corce(?) list class data into vector. I extract a tif file from polygon to achieve a list. Maybe the class of list is leaded by extract function. I check the list length ...
0
votes
0answers
328 views

Extract raster values from RASTERSBRICK using XY coordinates falling within each polygon R

I have a rasterbrick s (10000 raster layers) that actually is a time series raster. Accompanying s is a SpatialPolygonsDataFrame with many sub-polygons which can be identified by names and/or IDs etc. ...
0
votes
1answer
182 views

histogram of raster coordinates in R

I'm trying to generate an histogram of the y coordinates where raster values are 1. Mysteriously the following, different rasters, give me the same histogram. What could I be doing wrong? here are ...
0
votes
1answer
1k views

Converting raster stack to RGB GeoTIFF for use as a background image in maps using R?

I've been trying to use R to download google maps images as rasters, then convert them into GeoTIFF files which can be imported as a geo-referenced background layer in GIS programs. I've been ...
0
votes
0answers
826 views

Downloading NOAA AVHRR NDVI using R

I am using the gimms package to automatically download NDVI data from 1981-2013. The code is provided here. The data is available here. However, after running it shows that data has been downloaded ...
0
votes
0answers
1k views

Extracting multiple values from list and storing them in data frame using R?

I have a list of 3 SpatialPolygonsDataFrames. Every element has a number which is the perimeter. I want through a loop to store the numbers into one cell of a data frame like: 154,526,442. I tried to ...
0
votes
0answers
55 views

How to join CSV data (based on admin boundary names) to shapefile of aforementioned boundaries in R? [duplicate]

DATA: CSV data, Shapefile Hi all! I'm looking to perform what I've been taught is called a spatial join. After researching this further, it's looking like this operation is most often called a ...
0
votes
1answer
111 views

Exporting “pennLC” object stored in R as a shapefile

I need to export the pennLC object from package:SpatialEpi as a shapefile. pennLC contains different components of lung cancer dataset for Pennsylvania state such as: $geo, a data frame $data, a ...
0
votes
1answer
265 views

How to extracting values of 40 plots from different bands of raster image in R?

I have 40 plots(samples) and I want to extract corresponding values from different bands of RapidEye image. So at the end I want to have totally 200 values of 5 bands in the format of txt. Till now I ...
0
votes
0answers
154 views

Spatial segregation from a raster of racial distribution in the USA

I am trying to measure the degree of racial segregation at some geographic level (let's say the county level, for simplicity) in the USA. I have a shapefile with these geographic units. To do so, I'...
0
votes
0answers
146 views

Why does R(gdal) mangle data when converting to geojson?

I've encountered issues with projections in .geojson files created by rgdal, but I never thought it would destroy my data, until I tried this (reproducible example): downloader::download("http://...
0
votes
0answers
88 views

Rasterize and union problem

i've done the union first and then rasterized it. But now i want instead of that, to rasterize each one and then merge it as one. How do i do that? I mean without the union first off. on<-union(...
0
votes
2answers
878 views

Getting time-zones from latitude and longitude in raster using R?

I have a raster with longitudes and latitudes for the US with meteorological data (for about 100k grid points). I would like to get the time zone for each point in order to transform the time to local ...
0
votes
1answer
174 views

Multiple Subsetting [closed]

Input File, XY min,max file I have a XYZ .csv file for a large portion of an area. I have another txt file which contains Box numbers, Xmin, Ymin, Xmax, Ymax. I would like to export a CSV file for ...
0
votes
2answers
252 views

PostGIS raster write support in R

I want to push/write some generated raster layers to my postgres database directly in R. In theory this could be supported by the rgdal package, but sadly it isn't. In the latest version only copy, ...
0
votes
0answers
336 views

Dates are off when opening netcdf file in R

I have a netcdf file with the time dimension that goes from 12/2007 until 12/2010 with monthly time steps. I can see the correct dates in both arcgis and panoply. Panoply tells me this file is a ...
0
votes
0answers
57 views

Calculating mean and standard deviation for raster values using whole pixels within a polygon [duplicate]

I have a raster image and a corresponding shapefile. I would like to calculate the statistics of the values within polygons which have a common attribute but only using pixels which are fully ...
0
votes
0answers
140 views

Why does a shapefile shift after transformation?

I have a shapefile created in the raster package (ER_14.3_2000_poly). > #read in a raster file > ER_14.3_2000<-raster('E:/Ecoregions Models/Outputs/ER_14.3/ER_14.3_ConsensusMap3.asc') > ...
0
votes
1answer
215 views

Performing trend analysis with R?

I have data of monthly temperature for 60 years. I want to analyze the trend for the monthly temperature in R. How do I construct R Code which would analyze monthly trend over the time series to ...
0
votes
1answer
88 views

Combining postal codes into sales territories by value using R and ggplot2?

I have the shapefile for Canadian census subdivisions. For each subdivision I calculated some value (someValue). I want to combine census subdivisions into territories in such a way that territories ...
0
votes
1answer
109 views

Updating R version in R-ArcGIS/r-bridge?

I recently installed the R-ArcGIS bridge, following the steps on the associated github. I have ArcGIS 10.3, along with both R 3.2 & R 3.3 installed. It is only recognizing the R v3.2 installation, ...
-1
votes
2answers
800 views

Aggregation of MODIS 16 days data to annual data set

Is there a way to calculate mean annual NDVI and mean annual EVI from the time series MODIS images (2000 - 2016). I have gridded data downloaded to the local drive. Planning to use R for this work.
-1
votes
1answer
1k views

conversion of .img to binary file using R

I have a series of raster images which have to be converted to binary files. I request you to suggest a R code for conversion of all files at a time
-1
votes
1answer
78 views

Points don't show up on an overlaying shapefile?

library(ggmap) library(rgdal) cities<-c("city A","city B") country<-readOGR(dsn=".",layer="country") gc<-geocode(cities,source="google") gc$names<-c("city A","city B") coordinates(gc)<-...
-1
votes
1answer
1k views

Single point in R

My question might be very simple. I want to create a single point (with xy coordinates) in a specific region, in a specific position. I don't want to do that with qgis I want to do that in R. Is there ...
-1
votes
2answers
450 views

Order list of rasters R [closed]

I have some raster files which names are Band_2..., Band_3... etc. I want to order them from the minimum number (2) to the maximum (12). Here is the code I am using S2_masked<-"/2_1_R_Processed/...
-1
votes
2answers
307 views

Re-sample raster to acre grid using ArcGIS Desktop or R? [closed]

I have a 1m classified landcover raster layer that consists of values 1-4 representing various land covers. I need to resample this layer to an acre grid. Each acre in the resultant grid should ...
-1
votes
1answer
93 views

Calculating pairwise Spearman's correlation coefficients for multiple raster layers in R [closed]

I have six raster datasets with matching resolution and extent. I want to analyze the relation between those rasters by calculating pairwise Spearman's correlation coefficients for all combinations ...
-1
votes
1answer
36 views

Which R package has basic map data of Europe embedded?

Where can I find open source map data for countries in Europe? I need geographical data such as borders, rivers,elevation and I need also statistical data (population, etc.) Is there by chance an ...
-1
votes
1answer
770 views

changing projection in R without changing resolution [closed]

I have the following code to re-project my raster data. My problem is that when I change the projection, it seems that the resolution as well as pixel values change. I want to maintain the original ...
-1
votes
1answer
2k views

Select pixel values in a raster using R

I'm trying to select some cell values in a raster MODIS. Follow my problem: I have to filter these values to mask after it: 32767,32766,32765,32764,32763,32762,32761 I've used this code to one value:...
-1
votes
1answer
461 views

get_googlemaps returning map with warped longitude/latitude in R?

I'm trying to retrieve a tile of Downtown Los Angeles from Google Maps using ggmap and ggplot2, specifically the function get_googlemaps, and then I want to overlay a shapefile over it displaying the ...
-1
votes
1answer
1k views

Select polygons (A) that contain polygons (B) by using R code

I am wondering how to select polygons (A) that contain polygons (B) by using R code. B<-readOGR(dsn="H:/AP", layer="WWTP") A<-readOGR(dsn="H:/AP", layer="catchment")
-1
votes
1answer
1k views

How to read metadata file in R [closed]

How to read metadata file parameters( like sun elevation,REFLECTANCE_MULT_BAND etc ) from R How can end user validate the parameter of metadat file(.mtl)? How can I pass specified parameter of the ....
-1
votes
1answer
44 views

How to convert missing values to the mean of the other values in R? [closed]

I need to convert the missing values of a column in a dataframe with the rest of values of this column, grouped by Districts and Month. This is a sample of my df1: Date Day Month Year ...
-1
votes
1answer
61 views

Using R to extract data from Global Aridity Index and Potential Evapotranspiration (ET0) Climate Database v2? [closed]

I have a latitude/longitude dataset; I wish to extract the aridity index for each of location in R. I am new to R, so I seek basic code along with the required libraries.