Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do the following excercies in R langauge and answers the questions. Exercise 5.2 a. Create and store this data frame as dframe in vour R

Do the following excercies in R langauge and answers the questions.

image text in transcribed

Exercise 5.2 a. Create and store this data frame as dframe in vour R workspace: person sex uny Stan Francine F Med Steve Roger M High Hayley F Med Klaus M High Low 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, sex should 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 old-1,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 the age.mon variable in Section 5.2.2. Create a new version of mydata called mydata2 by deleting the age.mon column. Now, combine mydata2 with dframe, naming the resulting object mydataframe. b. c. d. e. f. Write a single line of code that will extract from mydataframe just of any records where the individual is female the names and ages and has a level of funniness equal to Med OR High. Use your knowledge of handling character strings in R to extract all records from mydataframe that correspond to people whose names start with S. Hint: Recall substr from Section 4.2.4 (note that substr can be applied to a vector of multiple character strings) g

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

8. What is the price elasticity of supply of Picasso paintings?

Answered: 1 week ago