Questions tagged [r]

Statistical computing language and software environment.

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

Working with multiple tiff files at one go

I want to predict my species of interest in the future using 4 Global Climate Models (GCM) at one go so that I can be able to plot outputs and save them as separate tiffs. code using single GCMs pfut &...
0 votes
2 answers
136 views

Extracting a raster from a large list in R

I have some code that returns a raster nested in a large list, I want to extract the raster from the list and save it as a tiff so that I can export it and use it in ArcGIS. my_raster<-raster("...
-1 votes
0 answers
28 views

R programming and coding [closed]

I have questions about making a loop or function to select all elements of a specific variable. Actually I have a variable with 100 names on that. Some thing like this: Area<- c(“Germany”, “Italy”, ...
0 votes
1 answer
34 views

How can I update a large raster with new values in R with speed?

I have a raster with 2332800 cells. Half of these cells are probably oceans and unneeded. I need to update these cells with new values. Right now I'm using a for loop and it takes a very long time: ...
6 votes
1 answer
5k views

Spatial distance join between polygon and points using R

I'm figuring out how to do a Intersection (Spatial Join) between point and polygons from shapefiles. My idea is to get the closest points and those points that match completely inside the polygons. In ...
0 votes
2 answers
413 views

Raster calculations in R

I have two rasters, one with land use data (raster A) classified in discrete values that represent different classes (1,2,3,4,5...18). The other one (raster B) contains data that can represent ...
1 vote
1 answer
37 views

Legend for confusion matrix in R

I have created a confusion matrix plot in R however I would like to get the legend that shows the values for the colours. How would I do this? So far I have the following: z = c(135,9,0,7,0,0,55,3, ...
0 votes
1 answer
12 views

Raster to SpatialPolygonsDataframe: close/crop polygons at the raster boundary, in R

library(raster) # read in bathymetery raster [https://drive.google.com/file/d/15kAcfQBJh_JiYgH-YrZZTJeeWOPd0Ysh/view?usp=sharing][1] r = raster('./ibcso.tif') plot(r) # set cells above sea level to ...
1 vote
1 answer
39 views

Reading NetCDF subset R

I'm having trouble trying to read a plus 2Gb NetCDF file from https://cds.climate.copernicus.eu/cdsapp#!/dataset/satellite-land-cover?tab=form in R If I try to read the whole file R returns me a ...
0 votes
1 answer
19 views

tmap, tm_arrange, make maps of similar size

I am currently producing maps using R’s package tmap. My goal is to combine two maps in a single PDF, and I want the extent of each map to be the same. The first map zooms in a given country and shows ...
0 votes
1 answer
78 views

rscript in QGIS processing toolbox and Rstudio, results mismatch

I am using my own R scripts in QGIS. Before adapting them to work in QGIS, I write them in RStudio to make sure they work properly. I then use different scripts in a batch model. In RStudio I have ...
0 votes
1 answer
36 views

What are the xmin, xmax, ymin, ymax values for Australia?

I am trying to crop the bioclimatic data from WorldClim.org to get environmental features only for the Australian habitat using the extent() method. Finally, I plan to combine the bioclimatic data ...
2 votes
1 answer
217 views

Rendering three-composition raster map with ternary colormap using R

Say there are three raster maps, representing percentages of sand, silt and clay respectively. The three values for each cell are hence summed up to 1. I want to use one raster map to characterize the ...
8 votes
1 answer
7k views

Distance to nearest point for every point same SpatialPointsDataFrame in R

I have a SpatialPointsDataFrame that I'm working with in R. I want to add a new vector to the dataframe that contains, for every point, the distance to the nearest other point in the ...
0 votes
1 answer
111 views

Get intersects of indexed grouped polygons between 2 SpatialPolygonDataframes in R

I am testing 2 different methods (m2b & hmm) for classifying the movement behaviour of penguins to ultimately classify feeding behaviour from GPS points and from these create kernel polygons to ...
0 votes
1 answer
179 views

How to extract forest cover type from Corine Land Cover raster in R

I'm working with Corine Land Cover Accounting Layers files called "CLC2018ACC_V2018_20.tif.ovr" and "CLC2000ACC_V2018_20.tif.ovr". My goal is to get both qualitative and ...
0 votes
1 answer
153 views

Adding attribute to SpatialPolygonsDataFrame in R

I have a SpatialPolygonsDataFrame with 14 different polygons. Each polygon currently has an attribute column "id", which is a single string that identifies the original colony, year, and ...
2 votes
1 answer
769 views

Split a polylines according to a specific point in R

I have 2 distinct spatial objects: on one hand I have a SpatialLinesDataFrame on the other hand I have a SpatialPointsDataFrame Considering one line and one point that intersects that line, I ...
1 vote
1 answer
19 views

R lidR write tree points to shapefile

I have created a tree point object using the locate_tree function. The tree point object is sfc_point and I want to write this to a shapefile. However, I am getting the following error. How can I fix ...
1 vote
1 answer
35 views

R lidR compute tree crown width

I have a LiDAR tile with segmented which includes respective tree IDs using silva2016. Now, I am looking for a way to compute the crown widths of each of the segmented trees. How or which metric can I ...
0 votes
1 answer
429 views

Estimating kernel bandwidth function with cross-validation gwrr package?

I am relatively new to R. I am attempting to use the gwrr package because I suspect that local collinearity may be an issue in my geographic weighted regression model. If I am not mistaken, I first ...
4 votes
2 answers
332 views

Extract pixel values in raster stack using shp

I am using the following code to extract mean pixel values over an area represented by a polygon: mean<-lapply(S2_stack, FUN=function (S2_stack) {data.frame(mean=extract(S2_stack, polygons2, fun=...
0 votes
1 answer
38 views

Create shapefile geometries from scratch using R

I would like to interactively create polygons from within R/RStudio. I am familiar with creating shapefiles using QGIS, but I would like to create a similar, but more streamlined workflow using R. ...
0 votes
1 answer
127 views

How can I load a very large raster (or portion of it) into R from an ArcGIS file geodatabase using R-Bridge (arcgisbinding)?

I have a large raster stored in an ArcGIS geodatabase (dimensions: 105,000x260,000) that I am trying to load in R. I have tried the following: library(arcgisbinding) arc.check_product() gdb <- &...
0 votes
1 answer
150 views

Dissolving large shapefiles of protected areas in R

My overall aim is to measure the number of GPS points that overlap with protected areas. I am using the protected planet database to source my shapefiles for Ireland and the UK. I don't need any ...
0 votes
0 answers
42 views

Getting OSM Data (e.g. maxSpeed) for route that is returned from OSM Routing

Is there any way to use the Openstreetmap Routing Service and use the returned route to get access to all the tags that the OSM data has for this route? Specifically, I am thinking about querying the ...
1 vote
2 answers
865 views

Cropping two rasters to common extent where pixelvalues are not nodata [closed]

I have two raster that overlap in a certain region. Like the following: What I would like to have, are two raster that only have values in the region where both rasters intersect, but also have ...
2 votes
3 answers
1k views

Joining nearest neighbor small polygons using R

The figure shows a plot of numerous polygons (zoom in) made from a raster file by require(sp) require(raster) pol100 <- rasterToPolygons(r, fun=function(x){x==1}, dissolve=FALSE) There polygon ...
1 vote
1 answer
118 views

How to Merge Multiple SpatialPolygonsDataFrames output using for loop in R?

I am calculating shadow cast using Shadow Package in R studio. I have successfully generated shadow cast by the three objects with specific heights for one whole day for every hour. The output I get ...
44 votes
10 answers
10k views

Seeking spatial R tricks

R is becoming pretty strong tool for handling and analyzing spatial data. I learned some useful things through questions like these at SO and thought it might be useful to have something simmilar, but ...
1 vote
1 answer
91 views

Can catalog_apply output a LAScatalog?

I am trying to use catalog_apply on a LAScatalog of 151 las tiles for my research. I have experimented with a catalog of 10 of these tiles, and with automerge = TRUE, the catalog_apply returns a huge ...
1 vote
0 answers
25 views

How to share QGIS R Processing Toolbox

I have developed a R Processing Toolbox. This has the file name: ToolboxRQGIS.rsx How can I share this toolbox with my colleagues in the easiest way? For a QGIS plugin, I can archive the developed ...
0 votes
1 answer
18 views

Confusion matrix plot in r

I have a computed confusion matrix from google earth engine that I would like to use in r to derive a plot. how do I manually enter the confusion matrix and plot in R?. This is the confusion matrix: 1:...
0 votes
0 answers
18 views

R lidR segment trees using Dalponte algorithm

When I run the code provided below, I get the following warning message. How I can resolve this error, as this message is returning segment_trees with zero trees? Message: In CPL_write_gdal(mat, file, ...
1 vote
1 answer
119 views

tmap interactive - missing values

I'm having some trouble trying to plot a raster in tmap. It has 14 unique classes and all of them display fine with tmap_mode("plot"). However when I set tmap_mode("view") some classes do not display ...
1 vote
2 answers
199 views

Clip several rasters with multipolygon and save them as separate rasters using R

I'm trying to replicate this [example][1] but I'm not getting separate raster as an output. In my example, I have a multipolygon which has 2 polygons and 2 raster. My output I want to be 4 raster ...
3 votes
1 answer
750 views

How to split a polygon into quadrants in R/Qgis?

I am solving the same problem as How to split a polygon into quadrants?, except that I am looking for a solution in R or QGis. So I have a polygon layer shapefile, which is unfortunatelly not exactly ...
7 votes
3 answers
5k views

Load a CSV as Simple Features R

Is there a direct way to load a CSV as an sf? I've looked through the sf documentation and nothing jumps out at me, currently using: my_csv <- read.csv('my_data.csv', header = TRUE) my_sp <- ...
0 votes
1 answer
30 views

Creating a catalog from raster files with terra in R

I would like to first explain what I aim to do. I am used to use the R package lidR and I find very useful the comand readLAScatalog, which creates a catalog, "a representation of a collection of ...
0 votes
2 answers
41 views

Subset polygons in R

I am trying to separate a specific area on my window of analysis. I have a georeferenced floor plan with rooms as polygons. I want to select and plot only some the rooms I tried this: rooms <- ...
1 vote
1 answer
73 views

Percentage of point features within polygon boundaries R

I am trying to create a histogram with the percentage of a concentration of points in a specific area. My data is someting like this: setwd("C:\\Users\\HP\\Desktop\\myrtos") getwd() library(...
0 votes
1 answer
158 views

problem with list.files() in R

here you have my data https://www.eea.europa.eu/data-and-maps/data/corine-land-cover-accounting-layers. I downloaded "CLC2000 Accounting Layer " file and "CLC2018 Accounting Layer" ...
2 votes
2 answers
58 views

Getting different Moran indexes?

I'm struggling to evaluate the spatial autocorrelation of several databases. These databases consist of coordinates and different environmental information associated with those coordinates. Strangely,...
0 votes
1 answer
305 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
12 views

R lidR save clip_roi object to a LAS file

I am trying to save a clip_roi object to a LAS file and I used the code in the following question. However I still get the same error: Error: Argument is not a LAS object How can I save a clip_roi ...
1 vote
1 answer
12 views

R lidR catalog_retile returns clipped output

I am trying to stich a few LAS tiles into a single file. The final retiled LAS appears to be clipped. How can I fix the clipping issue? LAS list catalog plot: Code: library(lidR) # Create a LAS ...
0 votes
1 answer
81 views

Interpolate temperature values (with associated lat and lon values) at different depth intervals using Krig function in the 'fields' R package

I have temperature data points in different depth intervals with associated lat long values across the study area. I want to make a raster and then interpolate between cells of the raster where there ...
0 votes
1 answer
3k views

Raster Interpolation

I have a three column dataset with LAT, LON and Temperature data I would like to produce a raster image that predicts the temperature of the landscape based on 24 data logger data points. The dataset ...
0 votes
1 answer
1k 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 ...
1 vote
1 answer
12 views

R lidR include filename of LAS object tile in interactive map popup

Is it possible to show the filename of the tile selected in the interactive leaflet plot? Currently it's empty as shown below. However, whenever I expand the object in the Environment pane, I can see ...

1
2 3 4 5
106