In-Class Vectors and DataFrame Practice
Intro to Quantitative Ecology:
Your group will submit a single document, but every member of your group needs to create their own markdown document and follow the code in the exercise.
Create a new R Markdown file and name it
in_class_vector_data_frame.Rmd
.
Create a first-level section called Vectors.
In your Vectors (first-level) section, create a second-level
heading called Names Create a new code chunk and create a
vector of your group members’ names using the c()
function
Your vector should be called group_names
. For example, I
might create a vector using the following code:
group_names = c(
"Mike Nelson",
"Meg McLean",
"Chris Sutherland"
)
Next, you’ll create two new more second-level headers, each with its own code chunk.
Call the first second-level header Majors, and within its
code chunk make a vector, group_majors
, containing each
group member’s major.
Note: your majors should appear in the same order that you used in
the group_names
vector above.
Your next second-level section should be called Graduation
Year and in it you should make a numeric vector,
grad_year
that contains each student’s expected graduation
year.
Finally, create a new first-level header and call it Student Info Dataframe.
In a code chunk, use the data.frame()
function, along
with the vectors you created above, to create a data.frame
object called group_info
.
group_info
should have three columns:
Create a final first-level heading and answer the following questions:
data.frame
different from a
matrix
?Render your Rmd source into an html document and one student per group will upload to Moodle. The document needs the following sections (which are described above):