Packages Used

library(dplyr)
library(openxlsx)
library(readr)
library(utils)

Example of Untidy Data

exceluntidy <- read.xlsx ("untidy practice 4 assignment.xlsx")
exceluntidy
         X1 Male Female
1 Chocolate    3      8
2   Vanilla   10      6

Example of Tidy Data

exceltidy <- read.xlsx("tidy practice 4 assignment.xlsx")
exceltidy
      Flavor Gender
1  Chocolate   Male
2  Chocolate   Male
3  Chocolate   Male
4  Chocolate Female
5  Chocolate Female
6  Chocolate Female
7  Chocolate Female
8  Chocolate Female
9  Chocolate Female
10 Chocolate Female
11 Chocolate Female
12 Chocolate Female
13   Vanilla   Male
14   Vanilla   Male
15   Vanilla   Male
16   Vanilla   Male
17   Vanilla   Male
18   Vanilla   Male
19   Vanilla   Male
20   Vanilla   Male
21   Vanilla   Male
22   Vanilla   Male
23   Vanilla Female
24   Vanilla Female
25   Vanilla Female
26   Vanilla Female
27   Vanilla Female
28   Vanilla Female

Students’ Age in Culinary Arts

age <- read.xlsx("part 2 CA student tidy practice 4 assignment.xlsx")
age
   Gender Age(yrs)
1    male       16
2    male       16
3    male       17
4    male       17
5    male       18
6  Female       15
7  Female       17
8  Female       16
9  Female       16
10 Female       17

This data was collect from level 1 Culinary Arts students currently enrolled at Keystone Central CTC. Students were asked if they were male or female and what their current age was. The variables “gender” and “age(yrs)” are examples of nominal measurement.

Chocolate Ranking

choc <- read.xlsx("part 2 choc tidy practice 4 assignment.xlsx")
choc
   Gender Preference
1    Male          1
2    Male          4
3    Male          2
4  Female          4
5  Female          3
6    Male          2
7    Male          4
8    Male          3
9  Female          2
10 Female          1

This data was collect from students currently enrolled in a baking course at Central Mountain H.S. Students were given a survey sheet and were asked to document if they were male or female and rank their liking of chocolate from 1 to 4. 1 representing a strong dislike for chocolate and 4 representing a strong like for chocolate. The variable “gender” is an example of nominal measurement, and the variable “preference” is an example of ordinal measurement.

Fruit Weight

fruit <- read.xlsx("part 2 fruit tidy practice 4 assignment.xlsx")
fruit
   Fruit Weight(oz)
1   pear        4.7
2   pear        6.3
3   pear        6.1
4   pear        5.8
5   pear        5.2
6  Apple        7.6
7  Apple        6.2
8  Apple        7.3
9  Apple        6.8
10 Apple        7.9

This data was collect during a lesson in Culinary Arts where students were learning to use balance, portion, and digital scales. Students were given pears and apples and asked to document the weight of ten pieces of fruit. The variable “fruit” is an example of nominal measurement, and the variable “weight(oz)” is an example of ratio measurement.