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
1answer
254 views

Highlight Borders When Mouseover Fill Area - Leaflet-R

Following the guidance of TimSalabim I separated the borders and fill of my neighbourhood polygons so that I could order them appropriately with zIndex. https://lawsblog.netlify.com/post/leaflet-map/ ...
16
votes
1answer
424 views

rMaps choropleth with custom json

With R I want to make an animated choropleth map with the rMaps package and a custom map. I tried to follow the example of Diego Valle described here and to use the custom map info for Datamaps. ...
-2
votes
1answer
25 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
1answer
38 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
0answers
16 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 ...
0
votes
2answers
280 views

Correlation between raster pixels within each polygon

I have two raster layers with the same extent, CRS, and resolution, and a shapefile consisting of a number of polygons. I would like to calculate the Pearson correlation between the two rasters within ...
2
votes
3answers
20 views

Extract 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; ...
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 ...
-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 ...
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
18 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
vote
0answers
389 views

How to load big ASCII rasters in Revolution R? [closed]

Is there anyone in this site using Revolution R with big spatial data? I am trying to load raster files (ascii format) into revolution R using the xdf format, with no luck. Did anyone tried this ...
0
votes
1answer
154 views

r-Mapview non reponsive with large simple feature dataframe?

I am trying to visualize a large sf dataframe with around 1000 rows containing linestrings with mapview::mapview() in R. Unfortunately a warning comes up when I perform the command: mapview(data....
2
votes
1answer
37 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
2answers
63 views

R sf count number of Polygons in Multipolygon

How can I count the number of polygons that are present in a multipolygon with the R package sf? Example: In the following image that represents a multipolygon I count 3 polygons. I want to be able to ...
1
vote
0answers
48 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
votes
0answers
15 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 ...
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
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 ...
0
votes
2answers
68 views

Slope, curvature, aspect with RQIS 3

I'm trying to calculate morfometrics index provided by SAGA using RQGIS 3 with QGIS 3.4 version. I`ve followed tutorial examples, but i dont have been successful. The script run, but don't produce ...
0
votes
0answers
22 views

Filtering data in R? [on hold]

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
2answers
1k views

R cannot read *.shp shapefile with rgdal

I'm trying to open ne_10m_urban_areas.shp with rgdal::readOGR, but it gives me the bellow error library(rgdal) a <- readOGR(dsn = path.expand("C:/.../Desktop/"), layer = "ne_10m_urban_areas.shp") ...
0
votes
0answers
24 views

Importing .flt file in R? [on hold]

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()...
1
vote
2answers
483 views

Difference between raster subsets as defined by another raster? [on hold]

I wish to determine whether there is a relationship between slope and the Corine land cover class pastures. i.e. whether areas defined as pasture have a different slope to non-pasture areas. I've ...
3
votes
1answer
93 views

Clockwise rotation bias in projection of shp

I am working on a land use/land cover map of Lebanon with QGIS. This shapefile has a .prj file, but apparently QGIS fails in recognizing the projection, as it results shifted northeastwards. See ...
-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. ...
0
votes
1answer
767 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 ...
-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 ...
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) : ...
0
votes
1answer
284 views

How to estimate 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 ...
2
votes
1answer
393 views

Filling NA gaps in raster with R?

I have soil data rasters from SoilGrids.org that have some small holes with NA cells (White spaces in the image) that I want to fill using some interpolation method to get a more spatially continuous ...
2
votes
1answer
34 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 ...
0
votes
1answer
16 views

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

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
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:\\...
3
votes
2answers
1k views

Identify polygon containing point with R sf package

I would like to be able to map geocoded coordinates to a region on a .shp file in R using the sf package. I can load up the map and plot it but I am struggling with the code to return the region for ...
1
vote
1answer
36 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 ...
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
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);...
3
votes
1answer
29 views

For a specific point in space, get the pixel in which that point lies (in R)

I am a bit new to the spatial packages of R. I have a hdf file from which I can get a data.frame with the latitude and longitude of the corners of the pixels, and the latitude and longitude of 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 ...
0
votes
2answers
335 views

Downloading MODIS data of cloud cover less than 10%

I use ModisDownload from rts package for downloading MODIS data. But is it possible to specify cloud cover and view angle before downloading? e.g. if I want to download MODIS data for cloud cover less ...
2
votes
2answers
729 views

Not able to bulk download MODIS images

I am trying to download Modis NDVI and EVI images. I have used the following R-code: setwd("/home/karthik/Valmiki/Modis_bands/") library(raster) library(RCurl) source("ModisDownload.R"...
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
564 views

Map all time steps of a NetCDF file in R using a loop

I have a NetCDF containing temperature values over a certain region for 2011, with 1-hour intervals, so that means that I have 8760 maps. What I want to do, is plot all 8760 maps using one color ...