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.

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

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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!