2  Wrangling data

Filter the starwars dataset so that only the characters of the Droid species are included. You should get a six row list from C3PO to BB8. You may want to make the table prettier by piping it into gt() to make a gt table.

starwars |> ______
_webr_editor_2 = Object {code: null, options: Object, indicator: Ke}
Hint 1

Consider using the filter() function from dplyr. Note that the species ‘Droid’ is capitalized.

Hint 2

You should filter the dataset using the species column. Remember to use “==” to test equality.

Fully worked solution:

Use the filter() function from dplyr:

1starwars |>
2    filter(species == "Droid") |>
3    gt()
1
Take the starwars dataset, and then,
2
Filter for the “Droid” species, and then
3
Pipe into gt() for a cleaner, scrollable table
Downloading webR