A brief guide to using the wcfish R package

1. Installation

Let’s begin by loading the wcfish package and its dependencies.

# Load package
library(wcfish)
library(tidyverse)
#> ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
#> ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
#> ✓ tibble  3.1.5     ✓ dplyr   1.0.7
#> ✓ tidyr   1.1.4     ✓ stringr 1.4.0
#> ✓ readr   2.0.2     ✓ forcats 0.5.1
#> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag()    masks stats::lag()

2. Datasets

The package includes the following West Coast fisheries datasets (listed below):

Coastwide datasets

California (CDFW) datasets

PACFIN datasets

Other West Coast fisheries datasets

3. Inspecting datasets

Every dataset is documented with metadata. To view the metadata for a dataset, use the ? command. For example, if you wanted to look at the meta-data for the cdfw_ports dataset, you would do the following:

# Examine the metadata for the cdfw_port dataset
?cdfw_ports

This will pop up a description of the dataset and its columns in the “Help” screen of your R text editor.

4. Saving the dataset as an object

You can save the dataset as an object in your R environment using the assingment operator:

# Save a dataset in your R environment
data <- wcfish::cdfw_ports

5. Preparing a quick plot of the dataset

We encourage you to work with the data and plot it based on your own needs. However, we also provide a plot_data function for generating a quick plot of the dataset of interest. Note that this only works for the CDFW datasets.

# Quickly plot a CDFW dataset
wcfish::plot_data("cdfw_ports")
#> Warning: Removed 50 rows containing missing values (position_stack).