Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given SmallSample.csv data. Please complete the following using this data and write a rscript. Please read SmallSample.csv data and create a data frame

You are given SmallSample.csv data. Please complete the following using this data and write a rscript.

  1. Please read SmallSample.csv data and create a data frame variable call smallsample.
  2. Please show the first six records to check data frame format
  3. Please show the structure of the data.
  4. Please check every columns class: age& income should be numeric; gender, marital, and risk should be factor. numkids (number of kids) should be integer. If they are not the correct type, please change them (hint: as.numeric() &factor())
  5. For the factor column, please display and check their levels and frequency for each level.
  6. Please calculate and display the mean of age and income for all the records
  7. Please calculate and display the mean of income for each category of risk
  8. Please create 3 bins for income, and label them low, medium, and high using equal width strategy. And please add a new column to the data frame of samll sample and call it INCOME LEVEL. Please assign the binning results to the new column.
  9. Please display how many records fall into low income level category.
  10. The CSV file looks like following which consists of more than 300 datas
  11. AGE INCOME GENDER MARITAL NUMKIDS RISK
    31 59193 Female married 1 good risk
    45 58381 Male married 1 good risk
    43 57388 Female married 0 bad loss
    41 56470 Male married 0 bad loss
    46 55554 Female married 0 good risk
    32 54792 Male married 1 good risk
    44 53983 Female married 1 bad profit
    44 53550 Male married 1 bad loss
    32 52973 Male married 1 bad profit
    39 52495 Female married 1 good risk
    44 51498 Male married 0 bad loss
    33 50631 Female married 0 good risk
    38 50076 Male married 1 bad profit
    35 49600 Male married 1 good risk
    34 49007 Male married 1 bad profit
    37 48061 Female married 1 good risk
    39 47161 Male married 1 good risk
    38 46823 Male married 0 good risk
    36 45949 Female married 1 bad profit
    30 45715 Male married 0 good risk
    42 45584 Female married 1 good risk
    43 45390 Female married 0 good risk
    35 45238 Female married 0 good risk
    38 45103 Female married 0 good risk
    37 44936 Female married 1 bad profit
    30 44756 Female married 1 good risk
    42 44597 Female married 1 bad loss

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

gpt 8 1 9 .

Answered: 1 week ago

Question

How are the securities lending market regulated?

Answered: 1 week ago

Question

Define the goals of persuasive speaking

Answered: 1 week ago