Skip to content

Commit 038ae8f

Browse files
Improve description of nan=
1 parent 8f5ffa8 commit 038ae8f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

man/nafill.Rd

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ nafill(x, type=c("const","locf","nocb"), fill=NA, nan=NA)
1414
setnafill(x, type=c("const","locf","nocb"), fill=NA, nan=NA, cols=seq_along(x))
1515
}
1616
\arguments{
17-
\item{x}{ vector, list, data.frame or data.table of numeric columns. }
18-
\item{type}{ character, one of \emph{"const"}, \emph{"locf"} or \emph{"nocb"}. Defaults to \code{"const"}. }
19-
\item{fill}{ numeric or integer, value to be used to fill. }
20-
\item{nan}{ (numeric \code{x} only) 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? }
21-
\item{cols}{ numeric or character vector specifying columns to be updated. }
17+
\item{x}{ Vector, list, data.frame or data.table of numeric columns. }
18+
\item{type}{ Character, one of \emph{"const"}, \emph{"locf"} or \emph{"nocb"}. Defaults to \code{"const"}. }
19+
\item{fill}{ Double or integer, value to be used to fill. }
20+
\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. }
21+
\item{cols}{ Numeric or character vector specifying columns to be updated. }
2222
}
2323
\details{
2424
Only \emph{double} and \emph{integer} data types are currently supported.
@@ -33,6 +33,10 @@ x = 1:10
3333
x[c(1:2, 5:6, 9:10)] = NA
3434
nafill(x, "locf")
3535

36+
x = c(1, NA, NaN, 3, NaN, NA, 4)
37+
nafill(x, "locf")
38+
nafill(x, "locf", nan=NaN)
39+
3640
dt = data.table(v1=x, v2=shift(x)/2, v3=shift(x, -1L)/2)
3741
nafill(dt, "nocb")
3842

0 commit comments

Comments
 (0)