NA_plot | R Documentation |
Plot NAs in a data set.
NA_plot(x, col = c("black", "white"), xlab = "Time", ylab = "Component",
text = "Black: NA; White: Available data",
side = 4, line = 1, adj = 0, ...)
x |
matrix (ideally an |
col |
bivariate vector containing the colors for missing and available data, respectively. |
xlab |
x-axis label. |
ylab |
y-axis label. |
text |
see |
side |
see |
line |
see |
adj |
see |
... |
additional arguments passed to the underlying
|
Indicate NA
s in a data set.
invisible()
.
Marius Hofert
## Generate 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
NA_plot(X) # indicate NAs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.