R/CDM_rbind_fill.R

Defines functions CDM_rbind_fill

Documented in CDM_rbind_fill

## File Name: CDM_rbind_fill.R
## File Version: 0.04


CDM_rbind_fill <- function( x, y )
{
    nx <- nrow(x)
    ny <- nrow(y)
    vars <- c( colnames(x), setdiff( colnames(y), colnames(x) ) )
    z <- matrix( NA, nrow=nx+ny, ncol=length(vars) )
    colnames(z) <- vars
    z <- as.data.frame(z)
    z[ 1:nx, colnames(x) ] <- x
    z[ nx + 1:ny, colnames(y) ] <- y
    return(z)
}

Try the CDM package in your browser

Any scripts or data that you put into this service are public.

CDM documentation built on Aug. 25, 2022, 5:08 p.m.