fill_value: Fill a time interval in a data frame with a specific numeric...

Description Usage Arguments Value Examples

View source: R/fill_value.R

Description

Assign specific values to a time interval.

Usage

1
fill_value(df, col, value, from, to)

Arguments

df

data frame with the first column being the date and the others numeric variables.

col

numeric vector with column(s) number(s) to be filled.

value

numeric or NA_real_. This numeric vector contains the elements to be fill in.

from

character, Date or POSIXct with the first date to be filled.

to

character, Date or POSIXct with the last date to be filled.

Value

A data frame filled with the value in the specified time period.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create a data frame
dates   <- seq.Date(from = as.Date('1990-01-01'), to = as.Date('1990-12-01'), by = 'm')
met_var <- runif(n = 12, 0, 10)

met_serie <- data.frame(dates, met_var)

# Fill serie
met_fill <- fill_serie(df = met_serie, colName = 'Temp', timeStep = 'day')

# Now fill value
met_fill <- fill_value(df = met_fill, col = 2, value = 10, from = '1990-02-01', to = '1990-02-15')

hydroToolkit documentation built on July 2, 2020, 1:04 a.m.