I have created a settlement plan on ArcGIS Pro, on which every polygon corresponds to a specific room in the settlement. All the polygons/rooms have some features (E.g. Fire Place, Bench etc.). I have extracted a csv file where all attributes and X and Y information is stored.
What I want to do is to plot in R only some of the rooms according to their features (E.g. only the rooms with a fire place).
Here is my initial code:
setwd("C:\\Users\\HP\\Desktop\\myrtos") getwd() library(rgdal) library(raster) library(Rcpp) library(maptools) library(spatstat) rooms <- readOGR (dsn="shp", layer="rooms") rooms <- as(rooms,"owin") roomattr <- read.csv (file="rooms.csv", header=TRUE) coordinates(roomattr) <- ~XCoord+YCoord
I tried to plot something like this, but apparently didn't work, there was no error message, but when I plotted the data there was nothing on the screen
constructions <- roomattr[which(roomattr$Rooms_csv.Bench == 'Yes'& roomattr$Rooms_csv.Platform == 'Yes'& roomattr$Rooms_csv.Ledge == 'Yes' & roomattr$Rooms_csv.Slab == 'Yes'),names(roomattr) %in% c("XCoord","YCoord")] pppconstructions <- ppp(x =coordinates(constructions)[,1], y =coordinates(constructions)[,2], window=rooms)
I also tryied combining the files
rooms = cbind(rooms, roomattr) and then plotting it
This method works only if I haven't run the
rooms <- as(rooms,"owin") first.
If I have run it I get the error:
Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 966, 84
The thing is that I need rooms shape file as window of analysis for plotting the rest of my data (points)
Is there any way to make it work?
I am also attaching a link of the data (csv and shp file)