Hey people of Stackoverflow!
I'm trying to see which factors increases the incidence of fire caused by lightnings, but I'm having problems creating a pixel image object using the im() function of the library spatstat.
The thing is the data I have is in the shape of the area and not a rectangle or square, so I can't transform the data into a matrix.
I tried to create a window with the function owin() and the poly argument, but I have ALL the points (including border and filling) of the area, so I can't get the polygon of the area.
So I need help to get ideas to a) create an pixel image object directly from my database or b) adding points to create a rectangle to then transform my data into a matrix and create with it the pixel image object.
I hope you can help me and if you need more info, please let me know.
Edit: Sorry for not putting an example of the data before.
So my data looks like this:
no. lon lat elev exp slope veg
1 700.5380 984.4786 548 -1 0 1
2 704.0483 984.4786 518 135 0 1
3 707.5586 984.4786 548 -1 0 1
4 711.0689 984.4786 569 254 4 1
5 714.5791 984.4786 590 178 5 1
6 697.0277 981.9342 518 -1 0 1
You can see a plot of the data here.
The other datafile I have only has the data of the lightnings.
Hope you can help me and thanks for everything!
Also, I can't use the im()
because I can't make my data into a matrix and I also tried to use owin(poly=data)
but it makes me a shape made of lines with the data, also I read more and I think owin wasn't the solution I needed either...
I'm reading right now other libraries to see if I can do the raster with other library instead of spatstat.