
```{r setup45aa, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning=FALSE,message = FALSE)
```

# Arne data analysis 

## Load packages and data

```{r}
library(tidyverse)
library(mgcv)
library(aqm)
library(sf)
```

In order to write up the assignment you can use maps generated in the previous chapters to illustrate how GIS techniques were applied.
You can then use the data that have been processed using the GIS components of R to conduct further analysis. 
It might be speculated that the density of regenerating pines (numbers of pines per square meter) in the heathland area may be influenced by the moisture of the soil, the amount of insolation the microsite receives, the height above sea level and/or the distance to the nearest seed source. Are any of these elements clearly related to pine density? 
You can analyse these data using the simpler non-aptial techniques that you have seen in the fist section of the unit. 

```{r}
data("arne_assignment_2022")
d %>% st_drop_geometry() ->d
d$Year<-as.factor(d$Year)
str(d)
```
Year = Year data was collected
Pine density = numbers of pines per meter squared  
twi = Topographic wetness index (no units)  
sol = Direct beam insolation  
slope = slope in degrees   
aspect = aspect in degrees   
pat_dist = Distance to nearest path in meters 
min_dist = minimum distance to nearest seed source.   
n50 = Number of large trees within 50 meters  

Are there any clear relationships between pine density and these variables? Analyse the data using techniques that you have learned on the course.

If you do not find relationships then this finding would still be useful. It would imply that the pine regeneration essentially takes place quite randomly over the area within which the data were collected.



 