A built-in iris data set gives the measurements in centimeters of the variables sepal length & width and petal length & width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. Please use ?iris for further details. (When you answer the following questions, don't output the data table as it would take up too much space in your R. Markdown document.) (i) Obtain a data subset that contains Sepal. Length, Petal. Length, Species variables and the last 25 observations. Save it in a variable named iris_sub1. For the answer, show your subsetting code and output of the data dimension by using dim() function. (ii) Obtain a data subset such that Petal. Length is less than 1.5 OR greater than or equal to 5. Save it in a variable named iris_sub2. Show your subsetting code and output of the data dimension. (iii) Obtain a data subset such that (Petal. Length is less than 1.5 OR greater than or equal to 5) AND (Species is virginica). Save it in a variable named iris_sub3. Show your subsetting code and output of the data dimension. (iv) Further subset iris_sub3 so that the new subset data contains only two variables: Petal. Length & Petal.Width. Save it in a variable named iris_sub4. Show your subsetting code and output of the data dimension.

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter7: Creating Templates, Importing Data, And Working With Smartart, Images, And Screenshots
Section: Chapter Questions
Problem 19AYK
icon
Related questions
Question

 Using R language

A built-in iris data set gives the measurements in centimeters of the variables sepal length & width and
petal length & width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa,
versicolor, and virginica. Please use ?iris for further details. (When you answer the following questions,
don't output the data table as it would take up too much space in your R. Markdown document.)
(i) Obtain a data subset that contains Sepal. Length, Petal. Length, Species variables and the last
25 observations. Save it in a variable named iris_sub1. For the answer, show your subsetting code
and output of the data dimension by using dim() function.
(ii) Obtain a data subset such that Petal. Length is less than 1.5 OR greater than or equal to 5. Save
it in a variable named iris_sub2. Show your subsetting code and output of the data dimension.
(iii) Obtain a data subset such that (Petal. Length is less than 1.5 OR greater than or equal to 5) AND
(Species is virginica). Save it in a variable named iris_sub3. Show your subsetting code and
output of the data dimension.
(iv) Further subset iris_sub3 so that the new subset data contains only two variables: Petal. Length
& Petal.Width. Save it in a variable named iris_sub4. Show your subsetting code and output of
the data dimension.
Transcribed Image Text:A built-in iris data set gives the measurements in centimeters of the variables sepal length & width and petal length & width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica. Please use ?iris for further details. (When you answer the following questions, don't output the data table as it would take up too much space in your R. Markdown document.) (i) Obtain a data subset that contains Sepal. Length, Petal. Length, Species variables and the last 25 observations. Save it in a variable named iris_sub1. For the answer, show your subsetting code and output of the data dimension by using dim() function. (ii) Obtain a data subset such that Petal. Length is less than 1.5 OR greater than or equal to 5. Save it in a variable named iris_sub2. Show your subsetting code and output of the data dimension. (iii) Obtain a data subset such that (Petal. Length is less than 1.5 OR greater than or equal to 5) AND (Species is virginica). Save it in a variable named iris_sub3. Show your subsetting code and output of the data dimension. (iv) Further subset iris_sub3 so that the new subset data contains only two variables: Petal. Length & Petal.Width. Save it in a variable named iris_sub4. Show your subsetting code and output of the data dimension.
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning