Files corresponding to Short Course: Introduction to Data Science Using R
Create a vector vec with elements 2, 4, 6, …, 12.
Write code to see the 1st, 3rd, and 5th elements of vec in the
console.
You can exclude elements from a vector by using a ‘-’ sign in
front of their indices. Utilize the length() function to see the
vec object in the console without its last element.
The iris dataframe is a built-in R object. Write code to show the
4th column of the iris dataset in the console (there are many ways
to do this!).
Write code to see just the first five rows and just the Species
and Sepal.Width columns of the iris object in the console.
Write code to see iris dataset in the console with the columns
displayed in alphabetical order. This can be done using the sort()
function. Use the result of sort(colnames(iris)) along with []
to select the columns in alphabetical order.