Question
A. Create and store this data frame as dframe in your R workspace: person Stan Francine Steve Roger Hayley Klaus sex funny M High F
A. Create and store this data frame as dframe in your R workspace:
person
Stan Francine Steve Roger Hayley Klaus
sex funny
M High F Med M Low M High F Med M Med
The variables person, sex, and funny should be identical in nature to the variables in the mydata object studied throughout Section 5.2. That is, person should be a character vector, sexshould be a factor with levels F and M, and funny should be a factor with levels Low, Med, and High.
-
Stan and Francine are 41 years old, Steve is 15, Hayley is 21, and Klaus is 60. Roger is extremely old1,600 years. Append these data as a new numeric column variable in dframe called age.
-
Use your knowledge of reordering the column variables based on column index positions to overwrite dframe, bringing it in line with mydata. That is, the first column should be person, the second column age, the third column sex, and the fourth column funny.
-
Turn your attention to mydata as it was left after you included theage.mon variable in Section 5.2.2. Create a new version of mydatacalled mydata2 by deleting the age.mon column.
-
Now, combine mydata2 with dframe, naming the resulting objectmydataframe.
Please answer the question as code that would be inserted into R
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started