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.2.7)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
It is important to save your work.
Save the vectors numbers <- c(34, 24, 19, 23, 16)
, numbers_2 <- c(1:200)
and treatment <- c("yes", "yes", "no", "no", "no", "yes")
. Use the name new_vectors
.
Use the function save(…). Note that you need to set the working directory.
<- c(34, 24, 19, 23, 16)
numbers <- c(1:200)
numbers_2 <- c("yes", "yes", "no", "no", "no", "yes")
treatment save(numbers, numbers_2, treatment, file = "new_vectors.RData")
Save the vectors events <- heart$event
and eyes <- retinopathy$eye
. Use the name vectors_survival
.
<- heart$event
events <- retinopathy$eye
eyes save(events, eyes, file = "vectors_survival.RData")
Let’s continue working on the data sets by loading our results.
Load the file new_vectors
.
Use the function load(…).
load("new_vectors.RData")
Remove unnecessary objects.
Remove the vectors numbers
, numbers_2
and treatment
.
Use the function rm(…).
rm(numbers, numbers_2, treatment)
Remove the vectors events
and eyes
.
Use the function rm(…).
rm(events, eyes)
© Eleni-Rosalina Andrinopoulou