n columns of data frame discarded

47 views Asked by At

I am using spatstat package in R to read my road network shapefile which also has some additional attributes.

When i am reading my shapefiles and converting them to as.psp(before I make them an object of linnet), I am getting n columns of data frame discarded. I do not understand why? The columns being discarded are my covariates for a linear network, so I am not able to bring them into my analysis.

Could someone give me an idea why this happens and how to correct it?

1

There are 1 answers

1
Ege Rubak On BEST ANSWER

Why it happens:

I would guess that we (spatstat authors) need to spend a bit of time discussing with the maptools guys how to handle the additional info in the SpatialLinesDataFrame object, and we haven't done that yet.

How to correct it:

You have to write some code on your own at the moment. You can extract the data from SpatialLinesDataFrame object by accessing the @data slot. Please provide specific data and how you need to use the additional data (what format do you need it in) if you need more help. You can find a few helpful commands here: https://cran.r-project.org/web/packages/spatstat/vignettes/shapefiles.pdf