Indexing and Subsetting - Practical

Preface

Open Rstudio to do the practicals. Note that tasks with * are optional.

R packages

In this practical, a number of R packages are used. The packages used (with versions that were used to generate the solutions) are:

  • survival (version: 3.5.7)

R version 4.3.2 (2023-10-31 ucrt)

Dataset

For this practical, we will use the heart and retinopathy data sets from the survival package. More details about the data sets can be found in:

https://stat.ethz.ch/R-manual/R-devel/library/survival/html/heart.html

https://stat.ethz.ch/R-manual/R-devel/library/survival/html/retinopathy.html

Indexing and Subsetting

Sometimes we want to obtain a subset of the data sets before investigating the descriptive statistics and performing the statistical analysis.

Indexing

Subsetting