qrmtools (version 0.0-6)

plot_NA: Graphical Tool for Visualizing NAs in a Data Set

Description

Plot NAs in a data set.

Usage

plot_NA(x, col = c("black", "white"), xlab = "Time", ylab = "Component",
        text = "Black: NA; White: Available data",
        side = 4, line = 1, adj = 0, ...)

Arguments

x

A matrix (ideally an xts object).

col

A bivariate vector containing the colors for missing and available data, respectively.

xlab

The x-axis label.

ylab

The y-axis label.

text

See mtext(). The text = "", it is omitted.

side

See mtext().

line

See mtext().

adj

See mtext().

Additional arguments passed to the underlying function image().

Value

invisible().

Details

Indicate NAs in a data set.

Examples

Run this code
## Generate some data
n <- 1000 # sample size
d <- 100 # dimension
set.seed(271) # set seed
x <- matrix(runif(n*d), ncol = d) # generate data

## Assign missing data
k <- ceiling(d/4) # fraction of columns with some NAs
j <- sample(1:d, size = k) # columns j with NAs
i <- sample(1:n, size = k) # 1:i will be NA in each column j
X <- x
for(k. in seq_len(k)) X[1:i[k.], j[k.]] <- NA # put in NAs

## Plot NAs
plot_NA(X) # indicate NAs

Run the code above in your browser using DataLab