Question: Please only submit R file. Each team only needs to submit one copy. Please write all team members name in the R file as comments.

Please only submit R file. Each team only needs to submit one copy. Please write all team members name in the R file as comments.

You are given the following data.

AGE

INCOME

GENDER

RISK

31

59193

Female

Low

45

58381

Male

Low

43

57388

Female

High

41

56470

Male

Medium

36

55554

Female

High

32

54792

Male

Medium

  1. Please use the age column data to create a vector called age.
  2. Please use the income column data to create a vector called income
  3. Please use the gender column data to create a vector called gender.
  4. Please use the risk column data to create a vector called risk. The order level for risk is low < medium
  5. Please check the class of each vector: age & income should be numeric; gender should be factor; and risk should be ordered factor.
  6. Please create a data frame called mydata using the four vectors.
  7. After create mydata, please display
    1. The second record
    2. Please display only the risk column using $
    3. Only show record 2 to 4
    4. For all records, please display only income and risk columns using one statement.

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!