Common Objects - Answers

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

Always check your data.

Common R Objects

It is important to distinguish the different object in R.

Vectors

Let’s investigate some vectors.

Matrices and Data Frames

Let’s investigate some matrices and data frames.

Arrays

Let’s investigate some arrays.

Lists

Let’s investigate some lists.