Question: Prob 3 . 0 2 Here are some useful operators for taking a quick look at data frames: names Lists the names of the components.

Prob 3.02
Here are some useful operators for taking a quick look at data
frames:
names Lists the names of the components.
ncol
Tells how many components there are.
nrow
head
Tells how many lines of data there are.
Prints the rst several lines of the data frame.
Here are some examples of these commands applied to the
CO2 data frame:
CO2= fetchData("CO2")
Called from: fetchData("CO2")
names(CO2)
[1] "Plant"
ncol(CO2)
[1]5
"Type"
"Treatment" "conc"
"uptake"
nrow(CO2)
Prob 3.03
[1]84
head(CO2)
Plant Type Treatment conc uptake
1 Qn1 Quebec nonchilled 9516.0
2 Qn1 Quebec nonchilled 17530.4
3 Qn1 Quebec nonchilled 25034.8
4 Qn1 Quebec nonchilled 35037.2
5 Qn1 Quebec nonchilled 50035.3
6 Qn1 Quebec nonchilled 67539.2
The data frame iris records measurements on owers.
You can read in with
iris = fetchData("iris")
Called from: fetchData("iris")
creating an object named iris.
Use the above operators to answer the following ques
tions.
1. Which of the following is the name of a column in
iris?
ower Color Species Length
2. How many rows are there in iris?
150100150200
3. How many columns are there in iris?
234567810
4. What is the Sepal.Length in the third row?
1.23.64.24.75.9
Thedata frame mtcars has data on cars from the 1970s.
You can read it in with
cars = fetchData("mtcars")
Called from: fetchData("mtcars")
creating an object named cars.
Use the above operators to answer the following ques
tions.
1. Which of the following is the name of a column in
cars?
carb color size weight wheels
2. How many rows are there in cars?
303132333435
3. How many columns are there in cars?
7891011
4. What is the wt in the second row?
2.1252.2252.6202.8753.215

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 Programming Questions!