Question: In this question, we will practice how to subset a data frame in R . Below is the code for creating a data frame representing
In this question, we will practice how to subset a data frame in R Below is
the code for creating a data frame representing data from a psychological study. Copy
and paste the code into your R studio editor and run the code. Answer the following
questions. Attach your code.
psychstudy data.frame
ID :
Age c
Gender cMale "Female", "NonBinary", "Female", "Male",
"Other", "Male", "NonBinary", "Female", "Other"
Ethnicity cAsian "Black", "White", "Hispanic", "White",
"Asian", "Hispanic", "Black", "Other", "White"
AnxietyScore c
HappinessScore c
a How to subset the column Ethnicity in three different ways?
b How to subset the columns Gender and Ethnicity in two different ways?
c How to subset the data of all columns for the first five participants?
d How to subset the Ethnicity and Gender for the first three participants?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
