Portal Data Review (dplyr)
If surveys.csv
, species.csv
, and plots.csv
are not available in your workspace download them:
Load them into R using read_csv()
.
- Create a data frame with only data for the
species_id
DO
, with the columnsyear
,month
,day
,species_id
, andweight
. - Create a data frame with only data for species IDs
PP
andPB
and for years starting in 1995, with the columnsyear
,species_id
, andhindfoot_length
, with no null values forhindfoot_length
. - Create a data frame with the average
hindfoot_length
for eachspecies_id
in eachyear
with no null values. - Create a data frame with the
year
,genus
,species
,weight
andplot_type
for all cases where thegenus
is"Dipodomys"
. - Make a scatter plot with
weight
on the x-axis andhindfoot_length
on the y-axis. Use alog10
scale on the x-axis. Color the points byspecies_id
. Include good axis labels. - Make a histogram of weights with a separate subplot for each
species_id
. Do not include species with no weights. Set thescales
argument to"free_y"
so that the y-axes can vary. Include good axis labels. - (Challenge) Make a plot with histograms of the weights of three species,
PP
,PB
, andDM
, colored byspecies_id
, with a different facet (i.e., subplot) for each of threeplot_type
’sControl
,Long-term Krat Exclosure
, andShort-term Krat Exclosure
. Include good axis labels and a title for the plot. Export the plot to apng
file.