Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Table of Contents

Reading the data 

...

Code Block
languagexml
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 called subset.male and for females called subset.female
  • How many participants are female and how many are male? HINT: Use dim to check the dimensions of subset.male and subset.female.  

Changing class

  • The data dictionary tells us that the variable male is categorical.  Check the class of male using the class 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 =

...