Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions man/frolladapt.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ dt
n34 = frolladapt(idx, c(small=3, big=4), give.names=TRUE)
n34
dt[, frollmean(value, n34, adaptive=TRUE, give.names=TRUE)]

## panel data: rolling mean within groups, respecting irregular date gaps
## equivalent to Stata: rangestat (mean) rollmean3 = sales, int(date -2 0) by(firm)
dt = data.table(
firm = rep(c("A", "B"), each = 4),
date = as.Date(c("2020-01-01", "2020-01-02", "2020-01-05", "2020-01-06",
"2020-01-01", "2020-01-03", "2020-01-04", "2020-01-07")),
sales = c(10, 12, 15, 13, 20, 22, 18, 25)
)
setorder(dt, firm, date)
dt[, rollmean3 := frollmean(sales, frolladapt(date, n=3L, partial=TRUE),
adaptive=TRUE), by = firm]
dt
}
\seealso{
\code{\link{froll}}, \code{\link{frollapply}}
Expand Down
3 changes: 1 addition & 2 deletions man/melt.data.table.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ more than once and the same column can be both as id and measure variables.
variables.

When all \code{measure.vars} are not of the same type, they'll be coerced
according to the hierarchy \code{list} > \code{character} > \code{numeric >
integer > logical}. For example, if any of the measure variables is a
according to the hierarchy \code{list} > \code{character} > \code{numeric} > \code{integer} > \code{logical}. For example, if any of the measure variables is a
\code{list}, then entire value column will be coerced to a list.

From version \code{1.9.6}, \code{melt} gains a feature with \code{measure.vars}
Expand Down
2 changes: 1 addition & 1 deletion man/nafill.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nafill(x, type=c("const", "locf", "nocb"), fill=NA, nan=NA)
setnafill(x, type=c("const", "locf", "nocb"), fill=NA, nan=NA, cols=seq_along(x))
}
\arguments{
\item{x}{ Vector, list, data.frame or data.table of logical, numeric or character columns. }
\item{x}{ Vector, list, data.frame or data.table of logical, numeric, character, or factor columns. }
\item{type}{ Character, one of \emph{"const"}, \emph{"locf"} or \emph{"nocb"}. Defaults to \code{"const"}. }
\item{fill}{ Value to be used to replace missing observations. See examples. }
\item{nan}{ Either \code{NaN} or \code{NA}; if the former, \code{NaN} is treated as distinct from \code{NA}, otherwise, they are treated the same during replacement. See Examples. }
Expand Down
Loading