After today’s lab you will be able to:
Describe the difference between R and Rstudio and distinguish between the console and a script file
Create an Rmarkdown document and describe and example of where you would use an Rmarkdown document.
Describe the difference between [] and () (e.g., when and how to use these different brackets/parentheses)
Use Google to troubleshoot/find useful functions.
Today we will create an Rmarkdown document to answer the following questions.
Use the iris
dataset to answer the following questions.
Please submit the answers as a well-formatted RMD (headings, code chunks/inline code, etc) and include the knit HTML. Each question should have code + output along with any necessary written explanations. Feel free to check the source code for this page or this cheatsheet for RMD references!
iris
What are the column names and data types of the different columns in iris?
How many rows and columns does iris have?
Create a single vector (a new object) called ‘width’ that is the Sepal.Width column of iris.
What is the 100th value in your ‘width’ vector?
What is the last value in your ‘width’ vector? Can you write code that returns this value even if you don’t know how long ‘width’ is? HINT: Google sis your friend when trying to fine new functions.
Select rows 10 to 20, with all columns in the iris dataset.
Select rows 10 to 20 with only the Species, Petal.Width and Petal.Length. Can you do this two different ways?
Select rows 1 to 10, 20, and 100 in the iris dataset.
Select the first value in the Sepal.Length column of the iris dataset. Bonus - can you do this three different ways?