fill_value {hydroToolkit} | R Documentation |
Fill a time interval in a data frame with a specific numeric value
Description
Assign specific values to a time interval.
Usage
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 |
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
# 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')
[Package hydroToolkit version 0.1.0 Index]