Eda - Quiz No.2
Eda - Quiz No.2
1. The data below represent the results of 70 individuals who took the depression test instrument.
1.1 Create a vector containing all the test scores and save it in a variable named score. [2 points]
1.2 Name the elements of the score vector with integer values from 1 to 20. [2 points]
2. Twenty individuals were given a list of 20 words to process. Half of them underwent shallow processing,
and the other half underwent deep processing. The table below shows the number of words correctly
recalled by the individuals.
2.1 Create a vector for each processing type, then save the vectors in variables shallow and deep
respectively. [4 points]
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
3. The table below reflects the number of individuals classified according to their body mass index and their
social well-being.
3.1 Create a matrix in R for this table and save it in a variable named that removes the frequencies under
the underweight rows (Use the function in extracting a matrix). [2 points]
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
4. From the SAMPLE_DATAV2 data frame, create a new data frame and name it FSvsGRADE_DF. This data
frame should include the variables below, with the
new variable name on their left:
G: GENDER
FS: FAVORITE SUBJECT
GE: GRADE ENGLISH
GM: GRADE MATH
GS: GRADE SCIENCE
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
5. Create a subset out of the FSvsGRADE_DF data frame with the conditions below. Save these subsets on
the respective variable given on their left. [2 points each correct code]
6. Use the data frames from item 5 to create the following vectors and save them in their respective variable
names on the left. [2 points each correct code]
6.1 GMath_FaveMath: Grade in math of all students whose favorite subject is Math.
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
6.3 GScie_FaveScie: Grade in Science of all male students whose favorite subject is
Science.
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
7. Using the dplyr package, manipulate SAMPLE DATAV2 to create a data frame with the following conditions and
save it in a variable ’NEWDATA’. Manipulate SAMPLE_DATAV2 in the following order:
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
7.1 The data frame should include all students whose favorite color is either blue,
red, or yellow, and whose grades in the three subjects are above 85. [2 points]
7.2 Add a column with the column name ’Ave.’ This column should contain the
average of the three subjects: Grade in Math, Grade in English, and Grade in
Science. [2 points]
7.3 Add a column with the column name ’Fave Math.’ This column should contain
’T’ if the favorite subject is ’MATH,’ otherwise ’F.’ [2 points]
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
Francisco, Gieselle Margarette BSCE 2-5
Gerona, Everett Gail
Pequit, Jeraldine
Viray, Darlene Nichole
8. From NEWDATA data frame in item VIII, compute the mean and the standard deviation of the average of the three
subjects (in ’Ave’ column) for each favorite subject. [2 points]