Chapter 5 R objects exercises

For this exercise produce the following tables as data frame in R. Please carry this out in your "Exercises.R" script and remember about code sections and annotations.
Solutions are in the expandable boxes. Try your best to solve each challenge but use the solutions for help if you would like. Even if your method works it can be good to check the solution as there are many ways to do the same thing in python.
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 |