Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Rstudio please provide your code as well as a screenshot of your code ## File: lab5 ## Author: A. Breitzman ## Description: Manipulating and

Using Rstudio please provide your code as well as a screenshot of your code

## File: lab5 ## Author: A. Breitzman ## Description: Manipulating and summarizing a data set ## ------------------------------------------------------------------------

## Instructions: This worksheet is worth 5 points ## Exercises are worth 2.5 point each. If you cannot get the code to work in the line limits specified, the maximum that you can earn per exercise would be 1.5 points.

## First we need to load a library library(MASS)

## If you got an error you may need to uncomment the next 2 lines #install.packages("MASS") #library(MASS)

dim(Cars93) ## 93 rows and 27 columns ## if you got an error message instead of 93 27 then go back to line 11 and reread it. ## Don't go any further until you get a 93 27 for line 15

##We can get the names of each column as follows names(Cars93)

##Recall to build a subset we can list the rows and columns we want. ##For example the next line will give us the first 2 rows and first 3 columns Cars93[1:2,1:3]

##Make a new file containing only columns I care about myCars <- Cars93[,c(1,2,3,5,7,8,10,11,12,25,26)]

##Let's look at first 2 rows myCars[1:2,]

##summary will give a nice summary of each column summary(myCars)

##Apparently in 1993 there was a car that cost only $7.400. Let's find it which(myCars$Price==7.40) ## Row 31 myCars[31,] ##Ford Festiva ##Note we could do the above in one step

myCars[which(myCars$Price==7.40),]

## Exercise 1 ## List all cars that cost under 10,000 in 1993 and only show the Manufacturer, Model, Price, and Cylinders ## Do it in 1 line ## Begin your code here

## End your code here

## Exercise 2 ## Repeat Exercise 1 with the following variation ## call the subset you create myCars2 and then do a summary of myCars2 ## you may have 2 lines for this ## Begin your cod here

## End your code here

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago

Question

describe the services that an outplacement consultancy may provide.

Answered: 1 week ago