# \donttest{
# 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)
# }
Run the code above in your browser using DataLab