Solution: Hands-on Data Filtering/Manipulation

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

We'll cover the following

Solution

How should we go about doing this?

As with anything in R, there are many different ways to do this. We could use square brackets, but we don’t do it that way since the assignment explicitly states to use the filter() function. Both techniques would require us to use logical statements.

Essentially, what we want is to create two new data frames. One data frame includes the individuals that metamorphosed up to 30 days into the period of metamorphosis and uses the Age.FromEmergence variable. The other includes those that emerged at 31 days or later.

Get hands-on with 1200+ tech skills courses.