R/sirt_rbind_fill.R

Defines functions sirt_rbind_fill

Documented in sirt_rbind_fill

## File Name: sirt_rbind_fill.R
## File Version: 0.05

## reimplementation of plyr::rbind.fill

sirt_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 sirt package in your browser

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

sirt documentation built on Aug. 11, 2023, 5:07 p.m.