@@ -14,11 +14,11 @@ nafill(x, type=c("const","locf","nocb"), fill=NA, nan=NA)
1414setnafill(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
3333x [c(1 : 2 , 5 : 6 , 9 : 10 )] = NA
3434nafill(x , " locf" )
3535
36+ x = c(1 , NA , NaN , 3 , NaN , NA , 4 )
37+ nafill(x , " locf" )
38+ nafill(x , " locf" , nan = NaN )
39+
3640dt = data.table(v1 = x , v2 = shift(x )/ 2 , v3 = shift(x , - 1L )/ 2 )
3741nafill(dt , " nocb" )
3842
0 commit comments