5 R objects exercises
For this exercise simply produce the following tables as data frames in R. Please carry this out in your “Exercises.R” script and remember about code sections and annotations.
Tip: You can either write completely new code or reuse and alter previous code.
5.1 df
Note: The top row is the column names and the left-most column is the row names.
One | Three | Five | |
---|---|---|---|
Two | 2 | 6 | 10 |
Four | 4 | 12 | 20 |
Six | 6 | 18 | 30 |
5.2 beach_df_2
Note: The top row is the column names and the left-most column is the row names.
Crab | Oystercatcher | Sandpiper | Starfish | |
---|---|---|---|---|
Formby | 10 | 5 | 1 | 3 |
West Kirby | 1 | 6 | 1 | 3 |
Crosby | 1 | 4 | 2 | 7 |
New Brighton | 4 | 4 | 3 | 4 |