filter_by_ocean: Filter FORCIS data by ocean

View source: R/filter_by_ocean.R

filter_by_oceanR Documentation

Filter FORCIS data by ocean

Description

Filters FORCIS data by one or several oceans.

Usage

filter_by_ocean(data, ocean)

Arguments

data

a data.frame. One obtained by ⁠read_*_data()⁠ functions.

ocean

a character vector of one or several ocean names. Use the function get_ocean_names() to find the correct spelling.

Value

A data.frame containing a subset of data for the desired oceans.

Examples

# Attach the package ----
library("forcis")

# Import example dataset ----
file_name <- system.file(file.path("extdata", "FORCIS_net_sample.csv"), 
                         package = "forcis")

net_data <- read.table(file_name, dec = ".", sep = ";")

# Add 'data_type' column ----
net_data$"data_type" <- "Net"

# Dimensions of the data.frame ----
dim(net_data)

# Get ocean names ----
get_ocean_names()

# Filter by oceans ----
net_data_sub <- filter_by_ocean(net_data, ocean = "Indian Ocean")

# Dimensions of the data.frame ----
dim(net_data_sub)

FRBCesab/forcis documentation built on Oct. 25, 2024, 9:26 a.m.