Z.clean.up: Clean Data

Description Usage Arguments Details Value Examples

View source: R/Z.clean.up.R

Description

A crude, brute-force way to destroy bad values in data.

Usage

1

Arguments

Z

Data. A τ x n matrix.

Details

This function replaces intractable values, e.g., NA, or -Inf, in data, with the global mean.

Value

A τ x n numeric matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
tau <- 10
n <- 7

Z <- matrix(1, tau, n)
Z[2,4] <- -Inf
Z[3,4] <- Inf
Z[4,4] <- NA
Z[5,4] <- log(-1)
Z

Z.clean.up(Z)





## The function is currently defined as
function (Z) 
{
    Z[Z == Inf | Z == -Inf] <- NA
    Z[is.na(Z) | is.nan(Z)] <- mean(Z, na.rm = TRUE)
    return(Z)
  }

widals documentation built on Dec. 8, 2019, 1:07 a.m.