Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
0 votes
1 answer
359 views

Creating coordinate points based on polygon

I am trying to create coordinate points based on a polygon that I've created in Google Maps and imported into R as an sf object. Specifically I have sample points of physical samples I've taken, but ...
1 vote
0 answers
463 views

Is there an R function for creating spatial weight matrix for “spatial difference in differences” method?

I am trying to apply "spatial difference in differences" method in R for a US county's block groups (n block groups) over 2 different times (2000 and 2015). In order to do this spatial ...
-1 votes
1 answer
32 views

Performing empirical bayesian kriging in R

I am trying to apply empirical bayesian kriging in R, but I cannot find a package that provides a function for EBK. Does anyone know of any or should I use ArcGIS?
0 votes
1 answer
25 views

Set random points within a given distance of a known street network [closed]

I have a street network with a known ditance of 39735 km. Now my goal is to set a point every 200 km on this street network, so that there will be exactly 198 points generated. The distance of 200 km ...
0 votes
0 answers
29 views

Pred and zlevel arguments from deprecated gdalUtils R library mosaic_rasters function [closed]

I'm trying to run some older R code that relies on the now deprecated gdalUtils library. I'm trying to find a way to run the following function in an equivalent way using a library like raster or sf. ...
1 vote
1 answer
626 views

Error while rendering Leaflet map on Shiny

I have been trying to reproduce a Leaflet map on a Shiny webpage. I have made this code so far: library(shiny) library(shinydashboard) library(leaflet) library(rgdal) library(dplyr) library(DT) Map &...
0 votes
1 answer
94 views

Preprocess daily Black Marble (VNP46A2) nighttime light product

I downloaded NASA's Black Marble daily product (VNP46A2) which is in h5 format (the data can be dowloaded from their website (it's free you just need to create and account)). One needs to preprocess ...
0 votes
2 answers
3k views

GSEA: unable to find an inherited method for function ‘keytypes’ for signature ‘"standardGeneric"’

I can't understand this problem. Even when I use the data and code offered at https://learn.gencore.bio.nyu.edu/rna-seq-analysis/gene-set-enrichment-analysis/ , the problem also existed. I did the ...
0 votes
1 answer
1k views

Plotting and/or exporting VIIRS SDR DNB data as GeoTIFF in R?

I already asked this question @stackoverflow however, perhaps it fits better here, due to the spatial nature of VIIRS data and the hdf5-eos file format. Im looking into how to handle .h5 (hdf-eos) ...
0 votes
0 answers
425 views

Warning using exact_extract in R

I have a grid cell shapefile of Africa of 55 km x 55 km. I would like to calculate a weighted average of the Terrain Ruggedness Index (explain here https://diegopuga.org/data/rugged/#grid) using as a ...
0 votes
1 answer
157 views

R SaTScan package not producing expected output

I am using the rsatscan package to automate a spatial scan statistic analysis. I'm attempting to eliminate the need to use the gui. I have been able to successfully create valid input files (geo,cas,...
2 votes
1 answer
248 views

Using spTransform CRS in Leaflet

I am producing Kernel density estimates for animals from tracking data. Location is input at x y data, I produce a spatial polygons dataframe from these coordinates. xy<-id[c("X", "Y&...
0 votes
1 answer
160 views

Format of Temperature data from University of Delaware

I am downloading Temperature data from University of Delaware (http://climate.geog.udel.edu/~climate/html_pages/download.html). In it data which I am downloading is under the following head: "...
0 votes
0 answers
29 views

SDM predict function error with 0.5 resolution

I have a little issue while running predict function for my SDM model, I get the following error message: Predict the number of values returned by the predict does not match the number of cells in ...
1 vote
1 answer
847 views

How to efficiently get the intersection between vector and raster in R?

What is an effective way to clip (intersect) a vector layer by raster values? Assume we have the following two layers: vec - a large vector dataset with polygons ras - a raster dataset which works as ...
0 votes
1 answer
23 views

Values of ordinary kriging with gstat and terra are equal as the input data

I am trying to interpolate a raster using ordinary kriging. When I use the data from meuse to try the model, I get an interpolated output. However, when I run the code with my own data, the ...
2 votes
2 answers
2k views

Using gdalbuildvrt in R gives Warning Message ... had status 1?

I want to make a mosaic out of several raster files that are next to each other, all including 4 bands. Due to saving space on the server I need to build a vrt and want to write the code in R, so I ...
0 votes
1 answer
19 views

Sampling 10% of cells in terra raster in R

(I am new to spatial analysis so please excuse if this is an obvious question) In terra, I have a SpatRaster of the world at 1km resolution (3006072000 cells, 5 layers). I would like to randomly ...
0 votes
1 answer
12 views

Rasterizing misaligned grids [r - terra]

I'm working with satellite data and trying to convert it to a raster in R. The downloaded product from NASA was vectorized on their end which is frustrating. The problem is that the satellite is ...
1 vote
2 answers
167 views

How to crop an ASCII file?

I have data downloaded from https://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-rev11. It is in an ASCII file, and I want to plot the map and the populations of just California. What is ...
2 votes
1 answer
150 views

Problem running GRASS 8.2 from R

I am attempting to use initGRASS in R and getting an error I haven't found in other answers so far. The error is as follows: sh: g.version: command not found Error in system(paste("g.version"...
1 vote
1 answer
616 views

Clipping/ Zooming in on shapefile using R

I'm working on a shapefile of all the villages of Portugal from this link. I've uploaded it to R: #read in shapefile of portugal portugal = readOGR(dsn = "./communities", layer = "...
1 vote
1 answer
529 views

RGEE getting pixel values and latitude and longitude

I am using Google Earth Engine on R. I'm trying to get a data set with the latitude and longitude of each pixel along with the value from the GEE Image Collection. I know its been done in JavaScript - ...
1 vote
1 answer
446 views

RStudio's Graphic Device plotting rasters too tiny?

I am having some issues when plotting rasters with the raster::plot function. It seems that my Rstudio's graphic device has some problem and the plots are just very very tiny. As of illustration, if ...
0 votes
1 answer
194 views

Error in optim: function cannot be evaluated at initial parameters

When trying to use optim I got this error : Error in optim: function cannot be evaluated at initial parameters This is the function I use in optim : stack_v = list(chlor_a = values(resample), layer = ...
0 votes
0 answers
17 views

How to Build and Export a MSAVI raster file from Google Earth Engine [closed]

I am working on a species distribution model for a lizard species in the American Southwest, from northern Utah to middle of Mexico, middle California east to middle New Mexico. One of the variables I ...
1 vote
3 answers
59 views

R: Error Data is too long

I have a R Script, that is extracting some information from a dem Raster through a multiprocess step. At one Point the standart deviation of the raster is calculated: std_ras <- sd(ras_smooth[], na....
0 votes
0 answers
7 views

Kcross inhomogenous function in R

I'm trying to compute a Kcross.inhom function for a multiple point patter object with the envelope function in R with the following code envelope_kcross <- envelope(p, ...
0 votes
2 answers
65 views

R classification of ADM0, ADM1, ADM2 and cities into 1x1 grid [closed]

I want to work on linking temperature to socioeconomic variables. there are wonderful databases offering 1deg x 1deg spatial resolution for temperature (such as CRU and the Berkeley BEST data base). ...
2 votes
1 answer
679 views

Adding a column in a raster attribute table in R to make a categorical one

#Get the names of all the files with extension ".tif" of the folder files <- list.files("C:\\Users\\user\\Desktop\\RCP26_2020\\", pattern='.tif$', full.names=TRUE ) files ...
0 votes
1 answer
478 views

Plotting Points in R with Google Map context. Error in download.file(urlStr, destfile, mode = "wb", quiet = TRUE)

I am trying to plot point data with Google Map context but i keep getting an Error. I tried the same using OSM context and it worked just fine. R Code below library(RgoogleMaps) Lat <- as.vector(...
0 votes
0 answers
48 views

st_intersection is duplicating rows

I'm using the sf package in R to understand how land cover changed from forest fires in BC, by overlapping burned areas (NBAC) with data from Dynamic World (DW). I have the DW data in the form of 5km ...
0 votes
0 answers
28 views

Create a NetCDF file from Excel for wind speed and direction in R Studio

I have an Excel spreadsheet of wind data that contains the wind speed and direction recorded at 5-minute intervals. I would like to create a NetCDF file for this data so the wind vector data can be ...
0 votes
0 answers
17 views

R crashes when loading basemap from basemaps package

Creating a domain over Europe. basemap_raster requests and downloads successfully but then R crashes. Am using R 4.3.2 and have tried with the stable and development version of basemaps. library(...
0 votes
0 answers
52 views

Some location data from telemetry data are getting moved after adding CRS

I have movement data (shp file) downloaded from MoveBank. It is being plotted perfect in ArcGIS Pro and in R just by plotting the shp file. But for my analysis, I am adding a CRS to the data and ...
2 votes
1 answer
405 views

Mac terminal and R show different GDAL versions

I am trying to read a .hdf file into R using: gdalUtils::get_subdatasets() but I am left with this error: ERROR 4: `/var/folders/24/9_h4zhq564g3zpvqp6jmbm0c0000gn/T//RtmpibWWKQ/MODIStsp/HDFs/MCD12Q1....
0 votes
0 answers
46 views

Mismatch of Points between QGIS and R loading with st_read()

I am working in QGIS version 3.30.0 in Windows 11 , and R Studio 2023.09.1 I have two gpkg files, one with polygons (called Segments) and one with points (which are charging stations) in the following ...
1 vote
1 answer
128 views

Incomplete set of least cost paths in R

In R, generate a conductance raster with "square" cells, derive the centroid of each cell, and compute the least cost paths (LCPs) between each pair of centroids through any of the possible ...
1 vote
1 answer
132 views

Create copies of rasters in R via GDAL

I am looking for an efficient way to create copies of rasters in R via GDAL. Since the advantages of such an approach might not be directly obvious, here is some more context. Via GDAL we can read ...
0 votes
1 answer
646 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
1 answer
227 views

Reducing image to vectors in rgee

I am using the package rgee in R to process satellite data via GEE. I have a Feature Collection: Counties<-ee$FeatureCollection('users/stephherbstritt/Counties') And an image: corn16<-ee$Image('...
1 vote
1 answer
180 views

Creating fishnet grid in R that sums values of points within grid instead of counts

I am very new to both coding and creating maps in R. Is it possible to create a fishnet grid in R that sums values of points within grid instead of counts? I have a dataset with locations for sewage ...
1 vote
1 answer
30 views

Is there a variable crown radius for li2012 in lidR?

I'm trying to implement a variable crown radius search using li2012 for segmentation of the point cloud in lidR. I've been following the steps in The lidR package and in section 7.2.3 would like to ...
0 votes
2 answers
229 views

Double indexing and looping over raster lists in R

I have a list of 63 rasters. They are the same extent, resolution, projection, etc. Because I extended 62 rasters to the maximum extent of the 63rd, I introduced NA values. However, these are relative ...
0 votes
1 answer
183 views

Buffers around linestrings have weird shapes (sf in R)

Update 10.11.23 Question (1) has been resolved, but answering question (2) is still in progress. Original Post I am trying to create buffers around (multi)linestrings representing international land ...
0 votes
2 answers
186 views

Authentification error when installing RGEE in RStudio

I am attempting to install the rgee package in RStudio, following this tutorial (https://cran.r-project.org/web/packages/rgee/vignettes/rgee01.html). I already have Google Cloud and Python installed. ...
1 vote
1 answer
394 views

Calling `Rscript` from QGIS Python Console / QGIS Plugin not working

I want to run a RScript that plots some data which is fetched by a QGIS Plugin. However it returns a non zero-exist status and breaks (when running with subprocess.check_call) or just skips the ...
1 vote
1 answer
1k views

Using over() function in R with Polygons and Raster

I want to calculate the average rain by region using the over function in R but I am getting the error "unable to find an inherited method for function over for signature RasterLayer, ...
2 votes
1 answer
677 views

Using spgrass6 and GIS_LOCK

I have one question about the use of GRASS within R session, i'm able to do some basic task, but i have one important issue is to use GRASS graphics through spgrass6::execGRASS. I'm aware of the ...
0 votes
1 answer
39 views

Some polygons are loading incorrectly as terra SpatVect but not SpatialPolygonsDataFrames

I am seeing an issue with some polygon features loading incorrectly as terra SpatVectors. I cannot replicate this issue yet, but here is an example polygon as an rds on Google Drive. If I load this ....

1
2 3 4 5
117