Consider the following data frame, df.
name age height eyes
1 bob 25 180 green
2 mike 23 178 green
3 mark 24 169 blue
4 steve 26 183 brown
How can we extract the name column and return the selection as a character vector?
- Wrong: This command will try to return a row called “name” and fail because there is no such row in
df. - Correct
- Wrong: This command will return the
nameandagecolumns as a \(4 \times 2\) data frame. - Correct
- Wrong: This command will return the
namecolumn as a one-column data frame.
Consider the following data frame, df.
name age height eyes
1 bob 25 180 green
2 mike 23 178 green
3 mark 24 169 blue
4 steve 26 183 brown
How can we extract the height column and return the selection as a data frame?
- Wrong: This command will return the
agecolumn as a numeric vector. - Correct
- Correct
- Wrong: This command will return the
heightcolumn as a numeric vector. - Wrong: This command will return the
heightcolumn as a numeric vector.