...

/

Solution: Create Factors and a Data Frame

Solution: Create Factors and a Data Frame

Let's have a look at the solution of the previous exercise.

Solution

Let’s start by making the factor. Since this course works with ecological data about red-eyed tree frog tadpoles, we’ll stick with that kind of data. Let’s imagine our three categories are three different species of tree frogs. Let’s choose hourglass tree frogs (HGTF), red-eyed tree frogs (RETF), and Rosenberg’s gladiator frog (GLDF).

We can combine the rep() and c() functions to make our factor. Each species abbreviation is repeated ten times, and those vectors are concatenated to create a single vector. ...