...
...
...
...
...
...
...
...
...
...
...
...
...
...
Table of Contents |
---|
Reading the data
...
Code Block | ||
---|---|---|
| ||
subset.4<-subset(dataframe, x < 5) #subset of the whole dataframe where x < 5 subset.4<-subset(dataframe, x == 5) #subset of the whole dataframe where x = 5 |
- create a subset of
sim.alspac
for males calledsubset.male
and for females calledsubset.female
- How many participants are female and how many are male? HINT: Use
dim
to check the dimensions ofsubset.male
andsubset.female
.
Changing class
- The data dictionary tells us that the variable
male
is categorical. Check the class ofmale
using theclass
function.
Descriptive / summary stats in R
contingency table (a summary table of 3+ variables) gender, age, BMI
table( )
ftable( )
summary stats mean, min, max and quantiles
summary()
histogram - to identify types of distributions of a variable
hist()
box and whisker plot summarizes graphically the min, max, 25-75 percentiles
...
Rounding numbers
signif(x, digits = 6)
# set how many significant figures using digits =
...