Question

In: Statistics and Probability

Import the RestaurantRating1 dataset in R and save the resulting data frame. RestaurantRating1 is shown below...

  1. 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

Solutions

Expert Solution

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)


Related Solutions

The data resulting from a random sample of 5 observations are shown below. Y is the...
The data resulting from a random sample of 5 observations are shown below. Y is the dependent variable, and X1 and X2 are the independent variables. Observation Y X1 X2 1 87 95 11 2 86 94 11 3 84 94 11 4 83 93 12 5 84 93 12 Use Excel's Regression tool to answer the following questions. To copy the data set, highlight the table, press Ctrl-c, click on the Excel cell to which you want to copy,...
1. Consider the builtin dataset iris. a. What is the structure of the iris data frame?...
1. Consider the builtin dataset iris. a. What is the structure of the iris data frame? b. Create a histogram of the Sepal.Width variable. c. Create a histogram of the Petal.Width variable. d. For both histograms, does the data appear normally distributed? Are they skewed? e. For both histograms, does it appear that the data come from more than one populations? f. What is the mean and median of Sepal.Width? What is the variance and standard deviation? g. What is...
Consider the dataset shown below where the decision attribute is restaurant
Consider the dataset shown below where the decision attribute is restaurantShown below is a partially developed decision tree. Finish creating the tree using the ID3 method. YOU WILL NOT RECEIVE ANY CREDIT UNLESS YOU SHOW ALL OF YOUR WORK IN TERMS OF ENTROPY AND INFORMATION GAIN CALCULATIONS!!!
a. In R there is an built in data frame Nile. This has the annual flow...
a. In R there is an built in data frame Nile. This has the annual flow in river Nile for year 1871 to 1971. Produce a time series plot. Print graph(s). b. add the title as "Nile River Annual Flow", x axis label as "Year" and y axis label as "Flow". Print graph(s). c. Add a horizontal line showing the average flow over these years. Print graph(s). d. Add text as: "Average Flow:" with the calculated average flow on the...
(1) Read in the data and create an R data frame named tennis.dfr that has the...
(1) Read in the data and create an R data frame named tennis.dfr that has the following names for its columns: first.name, last.name, major.match.wins, major.match.losses, overall.match.wins, overall.match.losses, major.titles, overall.titles. (Note that the data file has several explanatory lines before the real data begin that should be skipped when reading in the data lines.) NOTE: For the file name, you must use the following web address (URL): "http://people.stat.sc.edu/hitchcock/tennisplayers2018.txt". Please do not have your code read in the file from your own...
Instructions tell you how to get the data in R R has built in dataset called...
Instructions tell you how to get the data in R R has built in dataset called Iris. This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. We are interested in estimating the length of Petal (Y) using the length of Sepal (X). First, load the...
R has many build-in dataset. The data mtcars is one of them. The following R code...
R has many build-in dataset. The data mtcars is one of them. The following R code read-in data and save the data to input.                   input <- mtcars[,c("am","cyl","hp","wt")]              Write a few line of R code to conduct a regression analysis with am as the response variable, and              cyl, hp, wt as explanation variables.
Data Analysis & Visualization Topic R vector and save the r code in a text file...
Data Analysis & Visualization Topic R vector and save the r code in a text file Problem 1. Create two vectors named v and w with the following contents:      v : 21,10,32,2,-3,4,5,6,7,4,-22      w : -18,72,11,-9,10,2,34,-5,18,9,2 A) Print the length of the vectors B) Print all elements of the vectors C) Print elements at indices 3 through 7. D) Print the sum of the elements in each vector. E) Find the mean of each vector. (Use R's mean() function)...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can...
Fitting a linear model using R a. Read the Toluca.txt dataset into R (this dataset can be found on Canvas). Now fit a simple linear regression model with X = lotSize and Y = workHrs. Summarize the output from the model: the least square estimators, their standard errors, and corresponding p-values. b. Draw the scatterplot of Y versus X and add the least squares line to the scatterplot. c. Obtain the fitted values ˆyi and residuals ei . Print the...
Using R studio 1. Read the iris data set into a data frame. 2. Print the...
Using R studio 1. Read the iris data set into a data frame. 2. Print the first few lines of the iris dataset. 3. Output all the entries with Sepal Length > 5. 4. Plot a box plot of Petal Length with a color of your choice. 5. Plot a histogram of Sepal Width. 6. Plot a scatter plot showing the relationship between Petal Length and Petal Width. 7. Find the mean of Sepal Length by species. Hint: You could...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT