Skip to content

03. Functions #11

@briatte

Description

@briatte
  • 3.0 Functions, e.g.
    • Math
    • Data
    • Models – introduce formula notation
    • quickly mention plots, HTTP calls, whatever
  • 3.1 Control flow
    • The Human Narrative: # comments
    • The Computer Narrative: %>% pipe operator
    • Conditions: if/else, else_if, mutate_if, when
    • Sanity Checks: stopifnot – quickly mention unit tests for packages
  • 3.2 Iteration (with mentions of parallelization)
    • Loops: for, while – mention parallelization with foreach
    • Vectorization: sapply, lapply, mapply, map_* – parallelization with mcapply
    • Need for Speed? mention benchmarking
    • Reproducible Code:
      • Reproducibility = 10% code, 90% human documentation
      • Writing pseudo-makefiles for a data analysis folder
      • Makefiles + cron (with demo scraper)
  • Practice
  • Currently: Computing the Herfindhal-Hirschman Index
  • Add: Examples of calls using Stan, Julia, Python, shell?
  • Add: Game of Life example to show iteration and matrix computations (Petr Keil)

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions