This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE
parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
summary(lansing) #returns summary stats for the dataset
## Marked planar point pattern: 2251 points
## Average intensity 2251 points per square unit (one unit = 924 feet)
##
## *Pattern contains duplicated points*
##
## Coordinates are given to 3 decimal places
## i.e. rounded to the nearest multiple of 0.001 units (one unit = 924 feet)
##
## Multitype:
## frequency proportion intensity
## blackoak 135 0.05997335 135
## hickory 703 0.31230560 703
## maple 514 0.22834300 514
## misc 105 0.04664594 105
## redoak 346 0.15370950 346
## whiteoak 448 0.19902270 448
##
## Window: rectangle = [0, 1] x [0, 1] units
## Window area = 1 square unit
## Unit of length: 924 feet
str(lansing) #returns the structure of the dataset
## List of 6
## $ window :List of 4
## ..$ type : chr "rectangle"
## ..$ xrange: num [1:2] 0 1
## ..$ yrange: num [1:2] 0 1
## ..$ units :List of 3
## .. ..$ singular : chr "foot"
## .. ..$ plural : chr "feet"
## .. ..$ multiplier: num 924
## .. ..- attr(*, "class")= chr "unitname"
## ..- attr(*, "class")= chr "owin"
## $ n : int 2251
## $ x : num [1:2251] 0.078 0.076 0.051 0.015 0.03 0.102 0.135 0.121 0.04 0.065 ...
## $ y : num [1:2251] 0.091 0.266 0.225 0.366 0.426 0.474 0.498 0.489 0.596 0.608 ...
## $ markformat: chr "vector"
## $ marks : Factor w/ 6 levels "blackoak","hickory",..: 1 1 1 1 1 1 1 1 1 1 ...
## - attr(*, "class")= chr "ppp"
names(lansing) #returns names of callable elements of the dataset
## [1] "window" "n" "x" "y" "markformat"
## [6] "marks"
mytest <- quadrat.test(ants)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
plot(mytest)
ants
## Marked planar point pattern: 97 points
## Multitype, with levels = Cataglyphis, Messor
## window: polygonal boundary
## enclosing rectangle: [-25, 803] x [-49, 717] units (one unit = 0.5 feet)
ques3res <- quadrat.test(ants, nx=3, ny=3)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
ques3res
##
## Chi-squared test of CSR using quadrat counts
##
## data: ants
## X2 = 7.5508, df = 8, p-value = 0.9571
## alternative hypothesis: two.sided
##
## Quadrats: 9 tiles (irregular windows)
cataglyphis_ants <- subset(ants, marks == "Cataglyphis")
messor_ants <- subset(ants, marks == "Messor")
cataglyphis_test <- quadrat.test(cataglyphis_ants, nx = 3, ny = 3)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
messor_test <- quadrat.test(messor_ants, nx = 3, ny = 3)
## Warning: Some expected counts are small; chi^2 approximation may be inaccurate
cataglyphis_test
##
## Chi-squared test of CSR using quadrat counts
##
## data: cataglyphis_ants
## X2 = 5.5594, df = 8, p-value = 0.6071
## alternative hypothesis: two.sided
##
## Quadrats: 9 tiles (irregular windows)
messor_test
##
## Chi-squared test of CSR using quadrat counts
##
## data: messor_ants
## X2 = 6.2221, df = 8, p-value = 0.7553
## alternative hypothesis: two.sided
##
## Quadrats: 9 tiles (irregular windows)
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
envelope(lansing, Gcross, nsim = 99, i = 'maple', j = 'hickory') |> plot()
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
envelope(lansing, Kcross, nsim = 99, i = 'maple', j = 'hickory') |> plot()
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.
envelope(lansing, pcfcross, nsim = 99, i = 'maple', j = 'hickory') |> plot()
## Generating 99 simulations of CSR ...
## 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
## 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
## 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
## 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
## 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
## 99.
##
## Done.