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.

0
votes
0answers
20 views

Comparing distance matrices in R

I am trying to compare a distance matrix of microbial communities to a distance matrix of geographic sample locations to understand if there is a distance decay relationship in my dataset. The end ...
-2
votes
1answer
29 views

Tabulating land cover types of raster data in R? [on hold]

I would like to create a tabulation of cover types (raster) within a buffered area around a point of contact. Can someone point me in the right direction?
2
votes
3answers
24 views

Extracting coordinates of segments in raster from TIFF image?

I'm working with the attached tiff file and I am trying to extract the xy coordinates of the green lines. so far I saved the image as raster stack, and this specific image is from a layer of that ...
0
votes
0answers
11 views

Convert DWG to Shapefile Using FME and R

I converted a DWG file to an ESRI Shapefile using FME Workbench. Now I wish to create an elevation raster. I'm not sure how to extract the elevation info. library(sp) library(raster) # https://www....
1
vote
0answers
13 views

Raster correlation: Error (arg6) in raster.modified.ttest (R)

I am performing pairwise spatial correlation of 6 rasters using the raster.modified.ttest() function in R, as per this very useful post. I have consistently had the following error with my data; ...
-1
votes
1answer
18 views

Linear model in R - Multiplication Expression [on hold]

I have 3 numerical variables A, B and C. I am trying to create a linear model capable of predicting A. The expression that I am using is the product of B*C in order to predict A; however, when looking ...
2
votes
1answer
26 views

Transform CRS of Shapefile in R

I started with an AutoCAD DWG file and used FME Workbench to extract elevation data into a shapefile. read_sf yields: > shapename Simple feature collection with 41620 features and 1 field (with ...
0
votes
0answers
6 views

VeloxRaster_crop returns numeric

Curious as to why the following only returns a numeric vector with row and column information rather than a cropped raster: ras <- velox("dir.tif") cty <- st_read("cty.shp") ras <- ras$crop(...
0
votes
1answer
19 views

Using compareRaster (rasters): different extent? [on hold]

In R I'm trying to make a RasterStack of RasterLayers, they all have the same format, the only difference is that one of them is a solo raster and the others are bioclimatic variables. The soil layer ...
-1
votes
0answers
13 views

Importing data into R .flt? [on hold]

I was trying to do everything but my formula is still not working. mydata <- read.table("\\aaaaa.net\Finance_01$\NUC\Warsaw\20190416\20190416_MLT.flt", header=TRUE, sep="|") Error: '\F' is an ...
-1
votes
1answer
19 views

Is there a way to use lasfilterdecimate in lidR package that filters by pulse while using homogenize?

When I run lasfilterdecimate with the homogenize option excluding use_pulse =TRUE it works but when I include use_pulse=TRUE, it does not work. IE: The code below does not work currenttilethinned &...
0
votes
1answer
16 views

Making raster histogram excluding zeros in R?

In R, can I make a histogram of all the non-zero values in my raster? Some reproducible data below. I just want the histogram to be made with the zeros. Happy with a way to do that, or I guess to ...
0
votes
0answers
12 views

Convert DXF file to RasterLayer

I am an R user and have a .dwg file of city buildings that I wish to transform into a RasterLayer using the heights as elevation data. The metadata for the DXF file states: DXF File Metadata: ...
2
votes
2answers
100 views

Compressing georeferenced images

I have a bunch of georeferenced TIFF images created in QGIS. The person creating them saved them as uncompressed (around 1 GB each). I would like to compress them as LZW to save space. How can I do ...
2
votes
1answer
38 views

lidR (rlas) writeLAS change Classification attribute values

I have a point cloud with extra attributes: class : LAS (LASFˇ v1.4) point format : 6 memory : 2 Gb extent :7498400, 7499200, 5779500, 5780000 (xmin, xmax, ymin, ymax) coord. ref. ...
1
vote
0answers
21 views

Use geometry to join Spatial Dataframe

I have two Spatial Dataframe, the first one is the Paris Polling Stations from 2012, the other is the Polling Stations from 2017. They almost have the same geography, it deffers for 20 polygons (2017 ...
0
votes
0answers
22 views

Filtering data in R? [closed]

I have a data set where the 4th column is "book". I would like to filter this for "OPY". filter(data, book = "OPY") and I have an error that Error in filter: argument "filter" is missing, with no ...
0
votes
0answers
24 views

Importing .flt file in R? [closed]

How to import .flt-file into R? And do you know how to do "Text to columns" in R. Because my table is really messy where every cell is divided by "|". I tried with data1 <-read.table(file.choose()...
-2
votes
0answers
17 views

About join count test in R [closed]

I wanted to calculate the Moran's I for categorical variable. In my data I only have Latitude and Longitude of several places. And by using the joincount.test in R, I wanted to calculate Moran's I. ...
-2
votes
0answers
16 views

Object classification in R

I did a supervised pixel-based image classification using Random Forest algorithm in R. Now I would like to compare my results with object-based approach using the same classifier. Is it possible to ...
2
votes
1answer
39 views

Writing raster with attribute table in R?

I fitted a species distribution model and predicted the suitable habitat using this model, and then I got a map plotted in R. I tried to save this prediction as a raster, using code: rf<-...
0
votes
1answer
16 views

Visualizing Histogram of cell-specific values across layers of RasterStack using R? [closed]

Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season ...
2
votes
1answer
38 views

Extract areas with certain pixel values from raster

I have land cover data from GEE (https://developers.google.com/earth-engine/datasets/catalog/ESA_GLOBCOVER_L4_200901_200912_V2_3) for specific countries. I would like to extract the values from the ...
2
votes
0answers
18 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:\\...
1
vote
1answer
20 views

Add layer to RasterBrick R

I have a RasterBrick and I am trying to add new layers to it, (with addLayer) but every time I try I receive the following message: Error in sapply(x, fromDisk) & sapply(x, inMemory) : ...
1
vote
1answer
26 views

Appending polygons in R using sf

I'm trying to create a multipolygon dataset where each row is identifiable. Example below library(sf) library(raster) # example raster data r <- brick(nl = 2, nrows = 5, ncols = 10) set.seed(54);...
0
votes
0answers
15 views

Combining Bathymetric and Elevation Data using R?

Here is some elevation data of some islands. I wish to add depth info to the water. With the generous help of @Spacedman at Overlaying elevation data and bathymetry data in R I get: To resolve the ...
1
vote
0answers
34 views

Mean function from rts package, returns empty dataset, R

I am using the rts package in R and specifically the mean function, over a a gridded climatic dataset with many NA values. When I use apply.yearly(my_rts_object,mean) all I get is an empty raster ...
1
vote
0answers
15 views

Set attribute length when exporting features with st_write

I have sf features that I have created/manipulated in R that I need to export to shapefile (my client only accepts shapefile format so I cannot use .gpkg or other formats). I have used st_write to ...
0
votes
0answers
9 views

Extract random effects from CARBayes output

We conducted a study at the U.S. census tract level looking at the relationship between environmental factors and social mobility in the ten largest U.S. cities. We used CARBayes::S.CARmultilevel in R ...
1
vote
1answer
37 views

Overlaying elevation data and bathymetry data in R?

I have two layers that cover approximately, but not exactly, the same area. One is land elevation of some islands. The other is the depth of the water around the islands. I can resolve the vertical ...
1
vote
1answer
15 views

Transforming coordinates using R - SWEREF to WGS84

I have some coordinated in SWEREF 99 TM which I cannot convert into WGS84 using the proj4 package in R. temp <- data.frame (x = c(598223, 598812, 598824, 598232, 597614, 597629), y = c(...
2
votes
1answer
27 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
0answers
49 views

Why shapefiles created with sf package (in R) do not display same CRS in ArcMap?

I have created a polygon shapefile in ArcMap using 7 points(lat,lon) then read this shapefile into R to obtain the CRS. I then created a shape file in R using the sf package (and the 7 points) and ...
1
vote
1answer
22 views

Convert lists of coordinates to multiple lines based on ID at start of each block of coordinates

I have a list of XY coordinates along multiple lines. The lines are separated by a single identifier at the start of each block of coordinates. How do I convert this to multiple lines linking the ...
-4
votes
1answer
27 views

Performing geospatial analysis in R?

I obtained a rectangular sort of image when I subset shapefile on the raster image. I want to get exact irregular shaped image so that I can proceed my classification to that particular area (B is my ...
2
votes
1answer
30 views

How do I plot spatialpolygon dataframe layer on a leaflet map

I am not sure why this piece of code works library(leaflet) library(raster) adm <- getData('GADM', country='SGP', level=1) popup <- paste0("<strong>Name: </strong>", ...
-1
votes
1answer
27 views

The slot for “plotOrder” comes up as 1 instead of a vector with length specific to my data

My goal is to find neighbors from my SpatialPolygons object using the poly2nb() command from the sp package in R. This is my code thus far: p <- s_gis %>% select(long, lat) %>% ...
2
votes
1answer
38 views

Raster from point data in R different from point data in QGIS

I have some point data, with longitude, latitude and a value, in .csv file format. This is how the file looks in QGIS: I wanted to create a raster of this map, with each of the points ...
0
votes
0answers
30 views

Calculate shortest path distance on a network with R, sf and stplanr

I want to estimate a spatial logistic regression model for car crashes in Milan using R. I downloaded data from OSM for several highways segments in Milan using the R package osmdata. The response ...
0
votes
1answer
40 views

Opening Esri Geodatabase file with GDAL/QGIS/Grass?

EDIT: I have a 64-bit installation of QGIS but 32-bit Microsoft Office Access drivers. It has been suggested that this is the cause of the problem, which is also indicated in this post: https://www....
0
votes
2answers
33 views

Convert SpatialPoints to SpatialPointsDataFrame

Give an object x of class SpatialPoints how do I convert it to a SpatialPointsDataFrame ? class : SpatialPoints features : 50 extent : 3187836, 3827836, -489229.3, 950770.7 (xmin, ...
1
vote
0answers
18 views

Point to line interpolation using heading in R [closed]

I asked this question at StackOverFlow, but got no answers, so I thought I would try here also: I can draw a spline through 10 successive points like done in this post set.seed(1) n <- 10 x <- ...
2
votes
2answers
68 views

Is there a way to clip a layer with a shape from another layer in `sf`?

I would like to get the greens polygons that intersects (or overlapsed) the red outlined polygon (see image below). I tried sf::st_intersection() but the polygon in yellow (yes that just one polygon) ...
0
votes
1answer
16 views

rgdal installation error: How to set GDAL_DATA directory?

I've long had GDAL, proj, etc. installed and working fine for various other related software (e.g., QGIS). Unfortunately, every time R gets updated it tends to lose links to previously installed R ...
0
votes
1answer
14 views

Plotting Geographical Grid from Long/Lat Coordinates in R

I have a file of coordinates (Long/Lat) that should enable me to plot a series of 10km grid squares covering the UK. However, for each grid square I have five sets of coordinates by way of plotting ...
-2
votes
0answers
34 views

Using Hargreaves equation on raster bricks with climate timeseries data?

I am trying to calculate the spei for all pixels covering a certain region. Firsly, I have to calculate the ET with the Hargreaves equation. This equation requires time series of the minimum and ...
0
votes
1answer
36 views

Why raster layer name change to default when using raster::calc function?

Why raster layer name change to default when using raster::calc function, but not when using Arith-methods: Toy example copied from Reference manual (calc function). library(raster) r <- raster(...
2
votes
0answers
14 views

gIntersection error: linearRing not created

I am trying to do something relatively simple but with large shapefiles. I have a shapefile of protected areas in the USA: and watershed boundaries: I want to calculate the percentage and ...
0
votes
0answers
19 views

How to increase capacity of osrmRoute in osrm package in R

I had plotted the routes of some locations. The maximum number of locations allowed for routing using the OSRM package in R is 100 coordinate points. How can I extend beyond this restriction?