sea_input: Sea Level Input Function

View source: R/rIACI.R

sea_inputR Documentation

Sea Level Input Function

Description

Creates a data frame for sea level data input.

Usage

sea_input(Date = NULL, Value = NA)

Arguments

Date

Character vector. Dates in "YYYY-MM" format.

Value

Numeric vector. Sea level values (default is NA).

Value

Data frame with Date and Value columns.

Examples


# 1. Create a monthly sequence from 1960-01 through 2020-12
monthly_seq <- seq.Date(
  from = as.Date("1960-01-01"),
  to   = as.Date("2020-12-01"),
  by   = "month"
)

# Convert to "YYYY-MM" format, which sea_input() expects
sea_dates <- format(monthly_seq, "%Y-%m")

# 2. Generate random data with an upward linear trend plus some noise
n <- length(sea_dates)
linear_trend <- seq(0, 10, length.out = n)
random_noise <- rnorm(n, mean = 0, sd = 0.3)
sea_values   <- 10 + linear_trend + random_noise  # starts ~10, ends ~20

# 3. Create a sea level data frame with sea_input()
si <- sea_input(Date = sea_dates, Value = sea_values)

# 4. Inspect the first few rows
head(si)


rIACI documentation built on April 12, 2025, 9:16 a.m.