In: Statistics and Probability
Import the RestaurantRating1 dataset in R and save the resulting data frame. RestaurantRating1 is shown below as a table. Use some of the data wrangling techniques to transform the dataset into a tidy data. Use glimpse() function to show the resulting dataframe.
Donalds |
Fila |
King |
Payes |
Wendi |
1 |
3 |
1 |
1 |
1 |
2 |
3 |
1 |
1 |
2 |
2 |
3 |
1 |
2 |
2 |
3 |
3 |
1 |
2 |
2 |
3 |
3 |
1 |
3 |
3 |
3 |
3 |
5 |
3 |
3 |
3 |
3 |
5 |
4 |
4 |
4 |
3 |
5 |
4 |
4 |
4 |
3 |
5 |
5 |
4 |
5 |
3 |
5 |
5 |
5 |
Rcode:
RestaurantRating1 =read.table(header = TRUE, text ="
Donalds Fila King
Payes Wendi
1 3 1 1 1
2 3 1 1 2
2 3 1 2 2
3 3 1 2 2
3 3 1 3 3
3 3 5 3 3
3 3 5 4 4
4 3 5 4 4
4 3 5 5 4
5 3 5 5 5
"
)
filter(RestaurantRating1, Payes == 3| Wendi== 3 )
RestaurantRating1 %>% select(Payes, Donalds, Fila,King)
RestaurantRating1%>%summarise(avg_payes=mean(Payes),avg_Donalds=mean(Donalds),avg_Fila=mean(Fila),)
glimpse(RestaurantRating1)