Chapter 2 Data exploration

1. Make yourself familiar with the functions round() and paste() using the help pages for these functions. What kinds of arguments have to be provided, which arguments are optional? Define the vector numbers <- c(3.76, 3.9645, 5.396, 1.23) and use round() to round it to two decimal places. Then, use paste() to create a character vector that looks like this: (Find help in Chapter 2.1)

[1] "3.76 days" "3.96 days" "5.4 days"  "1.23 days"

 

2. Install and activate the R-Package MASS with install.packages() and library(). (Find help in Chapter 2.2)

 

3. Download the csv-file Melanoma.csv to your computer (you need to download the .zip-file from dosis and unpack it) and read it into R. For a description of the variables in the data set, use ?Melanoma. (Find help in Chapter 2.3)

 

4. Decide for all variables in the melanoma data frame if they have been read in with the correct data type. Convert at least the variables sex and status to factors, using the function factor() and its argument labels=. (Find help in Chapter 2.4.1 and with ?factor)

 

5. Compute a suitable measure of central tendency and measure of dispersion for the variable thickness. (Find help in Chapter 2.4.3)

 

6. Generate a table displaying the frequency of ulcer by sex. (Find help in Chapter 2.4.3)

 

7. Plot the distribution of age by status in a suitable way. (Find help in Chapter 2.4.4)

 

8. Find a numerical measure and a plot to investigate the association of thickness and age. (Find help in Chapter 2.4.3 and Chapter 2.4.4)