0% found this document useful (0 votes)
161 views5 pages

Engineering Data Analysis

Week 2 Homework
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
161 views5 pages

Engineering Data Analysis

Week 2 Homework
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

FULL NAME: Gonzales, Graciela Mariz B

SECTION: BSREM 3-2

Engineering Data Analysis Week 2 Assignment (70pts)

Show your R codes and the R output for each of the following problems. Make sure to paste the
screenshot/s of the relevant R panes after every question.

1. Use "faithful" data in Rstudio. Extract waiting variable and compute only the average of less than
or equal to 50 mins. of waiting time to next eruption. (5pts)

2. Create an 8 x 5 matrix that contains a number from 1 to 40. Fill matrix by columns. Make sure that
the names of the rows are Apple, Banana, Orange, Grapes, Mango, Limes, Watermelons and
Apricots, and the names of the columns are Blue, Red, White, Green, and Yellow. (7pts)
3. Create a factor, based on the information given: (5pts)

I asked 150 residents of Barangay Dela Paz to rate their level of agreement about mass testing. Most
of the respondents answered “Strongly Agree” with frequency of 60. Fifty of them answered “Agree”,
followed by “Disagree” and Strongly Disagree” with frequency of 30 and 10, respectively.

4. Create a scatter plot. Used “faithful” data in RStudio. Label the x-axis as ”Eruption time (min)",
the y-axis as “Waiting time to next eruption (min)” and include a title for the scatter “Eruptions of
Old Faithful”. (7pts)
5. Let’s say you're a student taking seven classes. Here's a table containing your final grades for
each class:

CLASS GRADES
Math 88.00
Chemistry 87.67
Writing 86.00
Art 91.33
History 84.00
Music 91.00
Physical Education 89.33

A. Create a vector containing the final grades for each class using the variable name “final_scores".
(3pts)

B. Create a vector of character data called “class_names" containing your classes. (3pts)

C. Assign the class name to each grade in your final scores vector. (5pts)
D. Extract elements from final scores vector and create two new vectors:

“liberal_arts": Containing your writing and history final grades. (5pts)

“fine_arts": Containing your art and music final grades. (5pts)

E. Calculate the average of each new vector. Assign the calculated results in variables
liberal_arts_ave and fine_arts_ave, respectively. (10pts: 5pts for each vector)
F. Calculate the average of the “final scores" vector that we created earlier. Store the result of your
calculation in the variable “average_grade". (5pts)

G. Compare “final_scores" to “average_grade " to see how the grade in each class compare to the
value stored in “average_grade". Create ifelse statements to tag the scores as follows: (10pts)

“below average” if element in final score < average_grade

“average” if element in final score = average_grade

“above average” if element in final score > average_grade

You might also like