Skip to content

Commit

Permalink
added initial draft
Browse files Browse the repository at this point in the history
  • Loading branch information
kumar-a committed Jul 13, 2023
1 parent 7fe66e8 commit 02cbb19
Show file tree
Hide file tree
Showing 328 changed files with 177,355 additions and 3,285 deletions.
16 changes: 16 additions & 0 deletions _freeze/posts/mid-domain-effect/index/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hash": "0bfb805344fc884011935eedffdf9cb4",
"result": {
"markdown": "---\ntitle: \"Mid-domain Effect\"\n\nauthor:\n - name: Abhishek Kumar\n url: https://akumar.netlify.app\n affiliation: Panjab University, Chandigarh\n affiliation_url: https://puchd.ac.in\n orcid: 0000-0003-2252-7623\n\ndate: 2023-03-21\n\nbibliography: refs.bib\n\ndraft: true\n\ngoogle-scholar: true\n \nformat: \n html: \n default-image-extension: svg\n---\n\n\n## Introduction\n\n\n::: {.cell}\n\n```{.r .cell-code}\nmin.elev <- 300\nmax.elev <- 1500\ndomain <- c(min.elev, max.elev)\n\nplot(domain, c(0, domain[2]-domain[1]), \n ylab=\"Range Size\", xlab=\"Range Midpoint\", type=\"n\")\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-1-1.png){width=672}\n:::\n\n```{.r .cell-code}\npool.distris <-runif(200, 0, domain[2]-domain[1])\nhist(pool.distris)\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-1-2.png){width=672}\n:::\n\n```{.r .cell-code}\nplot(domain, c(0,domain[2]-domain[1]), type=\"n\", \n ylab=\"Range Size\", xlab=\"Range Midpoint\")\npolygon(x=c(domain[1], domain[1]+(domain[2]-domain[1])/2, domain[2]), \n y=c(0, domain[2]-domain[1], 0), col=\"grey90\", border=\"grey80\")\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-1-3.png){width=672}\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfirst.range.size <-pool.distris[1]\nfirst.range.size\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] 540.6791\n```\n:::\n\n```{.r .cell-code}\nfirst.midpoint <-runif(1, domain[1]+( first.range.size/2), \n domain[2]-( first.range.size/2))\nfirst.midpoint\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] 1200.342\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nmidpoints <- lapply(\n 1:length(pool.distris),\n function(x, pool.distris, domain){\n runif(1, domain[1] + (pool.distris[x]/2), domain[2] - (pool.distris[x]/2))\n },\n pool.distris=pool.distris, domain=domain\n)\n\nmidpoints <- unlist(midpoints)\nhist(midpoints)\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-3-1.png){width=672}\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\ncurrent.distris <- t(apply(\n cbind(midpoints, pool.distris), 1,\n function(x){\n c(x[1] - (x[2]/2), x[1] + (x[2]/2))\n }\n))\n\n\ncolnames(current.distris) <- c(\"lower_distri_limit\", \"upper_distri_limit\")\nhead(current.distris)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n lower_distri_limit upper_distri_limit\n[1,] 909.6816 1450.3607\n[2,] 877.2127 1335.5652\n[3,] 598.5993 1324.4294\n[4,] 441.2734 978.3033\n[5,] 309.7641 1482.1332\n[6,] 943.1608 1461.2516\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nplot(domain, c(0, domain[2] - domain[1]), type=\"n\", \n ylab = \"Range Size\", xlab = \"Range Midpoint\")\npolygon(x=c(domain[1], domain[1]+(domain[2]-domain[1])/2, domain[2]), \n y=c(0, domain[2]-domain[1], 0), col=\"grey90\", border=\"grey80\")\n\napply(\n current.distris, 1, \n function(x){\n lines(x = c(x[1], x[2]), y = rep(x[2] - x[1], 2), col=\"darkorange\", lwd=2)\n }\n)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nNULL\n```\n:::\n\n```{.r .cell-code}\npoints(pool.distris ~ midpoints, cex=1, col=\"darkorange3\", pch=16)\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-5-1.png){width=672}\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# The number of cells to be used\ndomain.cells <-20 \n\n# this will create a matrix with the upper and lower limits that define the cells \n\ncells.limits <- seq(domain[1], domain[2], length.out = domain.cells + 1)\ncells <- matrix(0, domain.cells, 3)\ncolnames(cells) <- c(\"lower_cell_limit\", \"upper_cell_limit\", \"richness\")\ncells[,1] <- cells.limits[1:domain.cells]\ncells[,2] <- cells.limits[2:(domain.cells + 1)]\n\n# this will create a composition matrix where rows are cells and columns are species. A 1 means the species is present in the cell, a 0 means it is absent.\nfinal.composition <- matrix(0, domain.cells, length(pool.distris))\ncolnames(final.composition) <- rownames(current.distris)\nrownames(final.composition) <- 1:domain.cells\n\nfor (j in 1:nrow(current.distris)) {\n WhichCells <- intersect(which(cells[,1] < current.distris[j,2]), \n which(cells[,2] > current.distris[j,1]))\n final.composition[WhichCells, j] <- 1\n}\n\n# this calculates the number of species in each cell\ncells[,3] <- rowSums(final.composition)\n```\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\ncell.midpoints <- cells[,1] + ((cells[,2]-cells[,1])/2)\nplot(cells[,\"richness\"] ~ cell.midpoints, ylim=c(0, max(cells[,3])), \n ylab=\"Species Richness\", xlab=\"Domain\", \n pch=21, bg=\"grey60\", col=\"grey30\", cex=1.5)\n```\n\n::: {.cell-output-display}\n![](index_files/figure-html/unnamed-chunk-7-1.png){width=672}\n:::\n:::\n",
"supporting": [
"index_files"
],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions _freeze/posts/siwalik-alien-flora/index/execute-results/html.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"hash": "ad34e652f2cae7da8ba7a7641dd28be9",
"result": {
"markdown": "---\ntitle: \"Alien Flora of Indian Siwaliks\"\nauthor: \"Abhishek Kumar\"\n---\n\n::: {.cell}\n::: {.cell-output-display}\n```{=html}\n<div id=\"htmlwidget-e5161a653e726e9100f2\" style=\"width:100%;height:auto;\" class=\"datatables html-widget\"></div>\n<script type=\"application/json\" data-for=\"htmlwidget-e5161a653e726e9100f2\">{\"x\":{\"filter\":\"none\",\"vertical\":false,\"data\":[[\"1\",\"2\",\"3\",\"4\",\"5\"],[\"Ageratum conyzoides\",\"Lantana camara\",\"Parthenium hysterophorus\",\"Chromolaena odorata\",\"Tagetes minuta\"],[\"Invasive\",\"Invasive\",\"Invasive\",\"Invasive\",\"Invasive\"],[null,null,null,null,null]],\"container\":\"<table class=\\\"display\\\">\\n <thead>\\n <tr>\\n <th> <\\/th>\\n <th>Search<\\/th>\\n <th>InvasionStatus<\\/th>\\n <th>Origin<\\/th>\\n <\\/tr>\\n <\\/thead>\\n<\\/table>\",\"options\":{\"columnDefs\":[{\"orderable\":false,\"targets\":0}],\"order\":[],\"autoWidth\":false,\"orderClasses\":false}},\"evals\":[],\"jsHooks\":[]}</script>\n```\n:::\n:::\n",
"supporting": [],
"filters": [
"rmarkdown/pagebreak.lua"
],
"includes": {
"include-in-header": [
"<script src=\"../../site_libs/htmlwidgets-1.5.4/htmlwidgets.js\"></script>\r\n<link href=\"../../site_libs/datatables-css-0.0.0/datatables-crosstalk.css\" rel=\"stylesheet\" />\r\n<script src=\"../../site_libs/datatables-binding-0.26/datatables.js\"></script>\r\n<script src=\"../../site_libs/jquery-3.6.0/jquery-3.6.0.min.js\"></script>\r\n<link href=\"../../site_libs/dt-core-1.12.1/css/jquery.dataTables.min.css\" rel=\"stylesheet\" />\r\n<link href=\"../../site_libs/dt-core-1.12.1/css/jquery.dataTables.extra.css\" rel=\"stylesheet\" />\r\n<script src=\"../../site_libs/dt-core-1.12.1/js/jquery.dataTables.min.js\"></script>\r\n<link href=\"../../site_libs/crosstalk-1.2.0/css/crosstalk.min.css\" rel=\"stylesheet\" />\r\n<script src=\"../../site_libs/crosstalk-1.2.0/js/crosstalk.min.js\"></script>\r\n"
]
},
"engineDependencies": {},
"preserve": {},
"postProcess": true
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 02cbb19

Please sign in to comment.