# 2.3: Exercises

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$ $$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$$$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

1. In Exercise 1 of Chapter 1 you created a data frame with the following information about the first 18 elements.

• name
• symbol
• atomic number
• atomic weight
• phase (gas, liquid, solid)
• group number (1–18)
• row number
• electronegativity
• first ionization potential (in electron volts)

(a) Setting aside name and symbol, which of the remaining variables are categorical or numerical?

(b) For those variables that are categorical, which are nominal and which are ordinal?

(c) For those variables that are numerical, which are ratio and which are interval?

(d) For those variables that are numerical, which are discrete and which are continuous?

2. Use this link to download and save the spreadsheet marlybone_2018.csv. The data in this file gives the daily average level of NOX (the combined concentrations of NO and of NO2) in µg/m3 and the daily average temperature in °C as recorded in 2018 at a roadside monitoring station located on Marylebone Road in Westminster, which is near Reagents Park, Madame Tussaud's Wax Museum, and Baker Street, the "home" of Sherlock Holmes. The data is made available by London Air, a website managed by Kings College in London that reports results from the continuous monitoring of air quality at hundreds of sites spread throughout the greater London area. As in most long-term monitoring project, some data is missing for various reasons, such as equipment failure; these values appear in the spreadsheet as empty cells. If you wish, you can visit the London Air web site here.

(a) Use the read.csv() function to bring the data into R as a data frame and examine the dataset's structure using the head() function.

(b) Add a new column to the data frame that contains the running day number (January 1st is day 1 and December 31st is day 365).

(c) Use the subset() function to create separate data frames for each month.

(d) Save all of your data frames in a single .RData file so that it is available to you when working problems in other chapters.

3. Use this link to access a case study on data analysis and complete the five investigations included in Part I: Ways to Describe Data.

This page titled 2.3: Exercises is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by David Harvey.