Chapter 8 Appendix C: Installation and Quick Start Guide

8.1 Purpose of This Appendix

This appendix helps new users install and begin using lifesimulatoR.

No prior experience with R is assumed.

By the end of this appendix you should be able to:

  • Install R and RStudio
  • Install lifesimulatoR
  • Load the package
  • Run your first simulation
  • Access documentation and tutorials

8.2 Step 1: Install R

R is the programming language used by lifesimulatoR.

Download the latest version from:

https://cran.r-project.org

Follow the installation instructions for your operating system.

8.3 Step 2: Install RStudio

RStudio provides a convenient interface for working with R.

Download RStudio Desktop from:

https://posit.co/download/rstudio-desktop/

Install using the default settings.

8.4 Step 3: Install Required Packages

Open RStudio and run:

install.packages("remotes")

This package allows installation directly from GitHub.

8.5 Step 4: Install lifesimulatoR

Install the package from GitHub:

remotes::install_github(
  "NoushinN/lifesimulatoR"
)

Replace the repository name if it changes in the future.

8.6 Step 5: Load the Package

library(lifesimulatoR)

If no error appears, installation was successful.

8.7 Your First Simulation

Run a simple molecular evolution simulation:

sim <- simulate_abiogenesis(
  n_molecules = 100,
  generations = 100,
  mutation_rate = 0.02,
  selection_strength = 1,
  seed = 123
)

head(sim)

You should see a data frame describing how the population changed through time.

8.8 Create Your First Plot

plot_simulation(
  sim,
  x = "generation",
  y = "mean_fitness"
)

This plot shows how mean fitness changes throughout the simulation.

8.9 Exploring Diversity

Create a molecular population:

pool <- create_prebiotic_pool(
  n_molecules = 100,
  seed = 123
)

Summarize the population:

summarize_molecules(pool)

Calculate entropy:

counts <- c(10, 5, 1)

shannon_entropy(counts)

8.10 Exploring Protocells

cells <- protocell_simulation(
  n_cells = 20,
  steps = 100,
  seed = 123
)

head(cells)

Plot the results:

plot_simulation(
  cells,
  x = "step",
  y = "n_cells"
)

8.11 Exploring Autocatalytic Networks

network <- autocatalytic_network(
  n_types = 8,
  steps = 50,
  catalysis_probability = 0.2,
  seed = 123
)

head(network$time_series)

View the network structure:

network$catalysis_matrix

8.12 Accessing Help

View package documentation:

help(package = "lifesimulatoR")

View help for individual functions:

?simulate_abiogenesis
?create_prebiotic_pool
?protocell_simulation
?autocatalytic_network

View tutorials:

browseVignettes("lifesimulatoR")

8.13 Common Problems and Solutions

8.13.1 Package Not Found

Error:

there is no package called 'lifesimulatoR'

Solution:

Reinstall using:

remotes::install_github(
  "NoushinN/lifesimulatoR"
)

8.13.2 Function Not Found

Error:

could not find function

Solution:

Load the package first:

library(lifesimulatoR)

8.13.3 Plotting Error

Error:

argument "x" is missing

Solution:

Always specify both axes:

plot_simulation(
  sim,
  x = "generation",
  y = "mean_fitness"
)

8.13.4 Shannon Entropy Error

Error:

invalid 'type' (character)

Solution:

shannon_entropy() expects counts, not character sequences:

counts <- c(10,5,1)

shannon_entropy(counts)

8.14 Suggested Learning Path

New users are encouraged to follow this sequence:

  1. Getting Started
  2. Origin of Life: Big Questions
  3. Prebiotic Chemistry
  4. Molecular Evolution
  5. Diversity and Complexity
  6. Protocells
  7. Autocatalytic Networks
  8. Comparing Origin-of-Life Frameworks
  9. Classroom Labs and Activities

8.15 Next Steps

After becoming comfortable with the package you can:

  • Explore parameter sensitivity
  • Design new simulations
  • Extend existing functions
  • Develop classroom activities
  • Contribute to package development

8.16 Key Takeaways

  • lifesimulatoR is designed to be easy to install and use.
  • The package provides educational simulations inspired by origin-of-life research.
  • Simulations can be explored with only a few lines of code.
  • Documentation, vignettes, and labs provide guided learning opportunities.
  • The package can support teaching, self-study, workshops, and exploratory research.