File: na2zero.Rd

package info (click to toggle)
r-cran-popepi 0.4.13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,656 kB
  • sloc: sh: 13; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 894 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utility_functions.R
\name{na2zero}
\alias{na2zero}
\title{Convert NA's to zero in data.table}
\usage{
na2zero(DT, vars = NULL)
}
\arguments{
\item{DT}{\code{data.table} object}

\item{vars}{a character string vector of variables names in \code{DT};
if \code{NULL}, uses all variable names in \code{DT}}
}
\value{
A copy of \code{DT} where \code{NA} values have been replaced with zero.
}
\description{
Given a \verb{data.table DT}, replaces any \code{NA} values
in the variables given in \code{vars} in \code{DT}. Takes a copy of the
original data and returns the modified copy.
}
\details{
Given a \code{data.table} object, converts \code{NA} values
to numeric (double) zeros for all variables named in \code{vars} or
all variables if \code{vars = NULL}.
}
\author{
Joonas Miettinen
}