A Book Example
Preface
About the Authors
Stylistic Conventions
R code that is evaluated
R code in a script file (not evaluated)
I Learning R
1
Getting Started With R
1.1
What is R?
1.2
What is RStudio?
1.3
Who should learn R?
1.4
Why should I learn R?
1.5
Where can I get R?
1.6
How do I use R?
1.6.1
Using R on our computer
1.6.2
Does R have epidemiology programs?
1.6.3
How should I use these notes?
1.7
Just do it!
1.7.1
Using R as your calculator
1.7.2
Useful R concepts
1.7.3
Useful R functions
1.7.4
How do I get help?
1.7.5
Is there anything else that I need?
1.7.6
What’s ahead?
1.8
What are graphical models?
1.9
Precision and number types?
1.10
Problem exercises
1.10.1
Workspace
1.10.2
Math operations
1.10.3
Body mass index
1.10.4
Logarithm
1.10.5
Risk and risk odds
1.10.6
HIV transmission probabilities
1.10.7
Sourcing files
2
Working with vectors, matrices, and arrays
2.1
Data objects in R
2.1.1
Atomic vs. recursive data objects
2.1.2
Assessing the structure of data objects
2.2
A vector is a collection of like elements
2.2.1
Understanding vectors
2.2.2
Creating vectors
2.2.3
Naming vectors
2.2.4
Indexing vectors
2.2.5
Replacing vector elements (by indexing and assignment)
2.2.6
Operating on vectors
2.2.7
Converting vectors into factors (categorical variables)
2.3
A matrix is a 2-dimensional table of like elements
2.3.1
Understanding matrices
2.3.2
Creating matrices
2.3.3
Naming matrix components
2.3.4
Indexing a matrix
2.3.5
Replacing matrix elements
2.3.6
Operating on a matrix
2.4
An array is a
n
-dimensional table of like elements
2.4.1
Understanding arrays
2.4.2
Creating arrays
2.4.3
Naming arrays
2.4.4
Indexing arrays
2.4.5
Replacing array elements
2.4.6
Operating on an array
2.5
Graphical models—the story behind the data
2.5.1
Causal graphs are a type of Bayesian network
2.6
Problem exercises
Appendix
A
More to Say
B
The FOO Method
C
Solutions
References
Published with bookdown
Population Health Data Science with R
B
The FOO Method
We talk about the
FOO
method in this chapter.