Fix head function apply on 'ts_hydro' an 'ts_meteo' objects
The n
argument of the head()
function dos not work very well on 'ts_hydro' an 'ts_meteo' objects.
It only works when n <= 10
:
head(ts_flow)
# QmnJ (l/s) time series of 6 timesteps (0 discontinuities)
# Feature code: Y430651001
# Requested period: start: 1982-09-01 end: 1983-03-01
# v t md s q m c
# 1 1000 1982-09-01 <NA> 16 20 10 0
# 2 940 1982-09-02 <NA> 16 20 10 0
# 3 860 1982-09-03 <NA> 16 20 10 0
# 4 860 1982-09-04 <NA> 16 20 10 0
# 5 940 1982-09-05 <NA> 16 20 10 0
# 6 1000 1982-09-06 <NA> 16 20 10 0
head(ts_flow, n = 9)
# QmnJ (l/s) time series of 9 timesteps (0 discontinuities)
# Feature code: Y430651001
# Requested period: start: 1982-09-01 end: 1983-03-01
# v t md s q m c
# 1 1000 1982-09-01 <NA> 16 20 10 0
# 2 940 1982-09-02 <NA> 16 20 10 0
# 3 860 1982-09-03 <NA> 16 20 10 0
# 4 860 1982-09-04 <NA> 16 20 10 0
# 5 940 1982-09-05 <NA> 16 20 10 0
# 6 1000 1982-09-06 <NA> 16 20 10 0
# 7 940 1982-09-07 <NA> 16 20 10 0
# 8 910 1982-09-08 <NA> 16 20 10 0
# 9 850 1982-09-09 <NA> 16 20 10 0
head(ts_flow, n = 12)
# QmnJ (l/s) time series of 12 timesteps (0 discontinuities)
# Feature code: Y430651001
# Requested period: start: 1982-09-01 end: 1983-03-01
# v t md s q m c
# 1 1000 1982-09-01 <NA> 16 20 10 0
# 2 940 1982-09-02 <NA> 16 20 10 0
# 3 860 1982-09-03 <NA> 16 20 10 0
# 4 860 1982-09-04 <NA> 16 20 10 0
# 5 940 1982-09-05 <NA> 16 20 10 0
# 6 1000 1982-09-06 <NA> 16 20 10 0
# 7 940 1982-09-07 <NA> 16 20 10 0
# 8 910 1982-09-08 <NA> 16 20 10 0
# 9 850 1982-09-09 <NA> 16 20 10 0
# 10 850 1982-09-10 <NA> 16 20 10 0
NB: by default, n = 10
in the print.ts_*
functions.
print.ts_hydro <- function(x, ..., n = getOption("ts_max_print", default = 10)) {
.print_ts(x, n = n, par = .par_hydro, fun = "head")
}