fillVec | R Documentation |
Fill a vector, which should be of consecutive numbers, but due to missings is not containing only consecutive numbers (e.g., the residuals of a lm()) with values (default is NA). Optionally fill a second parallel vector also with replValue
fillVec(x, y = NULL, replValue = NA, verbose = FALSE)
x |
A numeric vector which should contain consecutive numbers, but isn't. |
y |
An optional second parallel vector which is also filled with replValue. |
replValue |
A numeric atomic vector which is used for replacement (default is NA). |
verbose |
Logical value, if verbose output should be given (default is FALSE). |
Returns a numeric vector in which missing consecutive values are replaced by replValue (e.g., NA).
Axel Zinkernagel zinkernagel@uni-landau.de
data <- c(1,2,3,4,5,6,7,8,10,11,12,13,16,17,18,20,25,30)
dataMod <- fillVec(data, verbose = TRUE)
y <- rnorm(18, -1, 1)
dataMod2 <- fillVec(data, y, verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.