dplyr
Bee Trait Data Basics
Connect to the BeeLab dataset on your local MySQL instance. In
R:
- Create a connection to the database using
RMariaDB
- Import the
bee_traits table into a named data frame.
- Check the column names in the data using the function
names().
- Use
str() to show the structure of the data frame and its individual
columns.
-
Print out the first few rows of the data using the function head().
Use dplyr to complete the remaining tasks.
- Select the first few rows of data from the Taxon_Author column and print it out.
- Select the data from the Family, Subfamily, and Tribe columns and print it out.
- Filter the data for all of the bees that are Parasitic and
print out their genus and species.
- Create a new data frame called
endangered_bees which have a value
of “endangered” in the USFWS_status column. Print it out.
[click here for output]