Methods Riddles, the ultimate revelations
2024-08-17 15:00:49
Preface
This bookdown has two main objectives: 1. documents all the steps, models, functions and results done during the 2. generate your own fakeworld with specific parameters and generate a fake archaeological records
To use this book you can follow it on the online version at thearchaeoriddle.org and copy paste the chunks on your local computer, or you can clone the source at the git repository here and compile the bookdown on your local machine.
Dependencies
If you want to for this to be successful, you will need to install a few additional packages. You can do this by running the following command, which will check if the packages are installed and install them if not, then load them.
=c("terra","sf","igraph","devtools")
needed=sapply(needed,require,character.only=T)
successsapply(needed[!success],install.packages)
## named list()
=sapply(needed,require,character.only=T)
success::terraOptions(progress=0) #by default terra show a progress bar when applying function to large raster, this messes with our output so we set it to zero to remove it. terra
These packages will very likely need other packages that will depend on your operating system, so check the error messages from the previous commands.
You will also need to install and load the package associated with the bookdown by doing
::install_github("acortell3/archaeoriddle")
devtoolslibrary(archaeoriddle)
Compiling the book
If you want to compile the book yourself, you will need bookdown
and a few more packages used to render the book. But first, you will need to clone the repository:
git clone https://github.com/acortell3/archaeoriddle/
cd archaeoriddle
Once done you can then load the package using the local source:
::load_all()
devtools## ℹ Loading archaeoriddle
## Warning: ── Conflicts ──────────────────────────────────────────────────────────────────────────────── archaeoriddle conflicts
## ──
## ✖ `A_rates` masks `archaeoriddle::A_rates()`.
## ✖ `changePopSize` masks `archaeoriddle::changePopSize()`.
## ✖ `D_along` masks `archaeoriddle::D_along()`.
## … and more.
## ℹ Did you accidentally source a file rather than using `load_all()`?
## Run `rm(list = c("A_rates", "changePopSize", "D_along", "death", "environment", "fightbetterloss", "Gpd", "initKs",
## "initlistsites", "initpopstruc", "K_lim", "logisticdecay", "long_loss", "perlin_noise", "Pop_stoch", "Rec_c",
## "run_simulation", "short_loss", "simplefight", "TK95", "warpoints", "whotouch"))` to remove the conflicts.
And then install the specific packages to render the book.
=c("DiagrammeR","bookdown","igraph","gifski")
compneeded=sapply(compneeded,require,character.only=T)
successsapply(needed[!success],install.packages)
=sapply(compneeded,require,character.only=T) success
Using load_all()
instead of install(...)
will allow you to modify the source code and reload the package after any change, thus making test and integration of your own implementation way easier.
Once the package has been loaded or installed, you can then render the book locally. Note that this may take a long time as it generate a full new world, and run a couple of simulations and examples.
::render_book() #you need to be in the folder 'doc/bookdown/' bookdown