Which plants are better for bees: native or non-native?
📖 Background
I work for the local government environment agency and have taken on a project about creating pollinator bee-friendly spaces. Native and non-native plants can be used to create these spaces and therefore you need to ensure that you use the correct plants to optimize the environment for these bees.
The team has collected data on native and non-native plants and their effects on pollinator bees. The task will be to analyze this data and provide recommendations on which plants create an optimized environment for pollinator bees.
💾 The Data
I have assembled information on the plants and bees research in a file called plants_and_bees.csv
. Each row represents a sample that was taken from a patch of land where the plant species were being studied. The columns relevant to the challenge are listed here
Column | Description |
---|---|
sample_id | The ID number of the sample taken. |
bees_num | The total number of bee individuals in the sample. |
plant_species | The name of the plant species the sample was taken from. None indicates the sample was taken from the air. |
bee_species | The bee species in the sample. |
nonnative_bee | Whether the bee species is native or not (0:no, 1:yes). |
Source (data has been modified)
💪 Challenge
Provide your agency with a report that covers the following:
- Which plants are preferred by native vs non-native bee species?
- A visualization of the distribution of bee and plant species across one of the samples.
- Select the top three plant species you would recommend to the agency to support native bees.
library(readr)
library(ggplot2)
library(knitr)
Import Data and Inspect Initial Entries
with head() Function
data <- read_csv("data/plants_and_bees.csv", show_col_types = TRUE)
head(data)
Examine Data Structure using spec(data)
(spec(data))
Explore Unique Values in Relevant Columns using unique(data$column)
Unique "Plant Species" Values
unique_plant_species <- as.data.frame(unique(data$plant_species))
unique_nonnative_bee <- as.data.frame(unique(data$nonnative_bee))
unique_plant_species
Unique "nonnative_bee" Values
unique_nonnative_bee
To ensure accurate decision-making regarding the optimal plants, it is necessary to exclude rows that have a "None" value in the $plant_species column.
‌
‌