## Lab: R, SQL, XML

## Task 1

Download and install R (or RStudio) plus the packages

*XML*and*RCurl*.## Task 2

Follow the R scripts (commands) from the lecture notes.

## Task 3

For the built-in dataset

*sunspots*, carry out the following queries:- How many years were fewer than five sunspots observed?
- In which years were fewer than five sunspots observed?
- What were the average number of sunspots between 1960 and 1969 (inclusive)?
- Which year had the most sunspots?
- What were the total number of sunspots in each year?
- What were the average number of sunspots for August?
- What is the standard deviation of sunspots?
- Which years were an outliers,
*i.e.*, number of sunspots with more than 3 z-scores?

## Task 4

For the XML document https://www.w3schools.com/xml/simple.xml, carry out these queries:

- What is the average price of a food item?
- List the names of all foods
- How many food items are on the menu?
- Which food items have fewer than 700 calories?

## Lab Notes

- Be careful with [] vs ()