bind.fill: Bind Fill

View source: R/util.R

bind.fillR Documentation

Bind Fill

Description

This function creates a cbind matrix or rbind matrix using a list containing different length of numeric vectors.

Usage

bind.fill(List, type = c("rbind", "cbind"), fill = NA)

Arguments

List

A list containing different length of numeric vectors

type

A character string specifying whether rbind is used or cbind is used.

fill

The value used to fill in missing data when aligning datasets. For type = "cbind", this fills missing rows in shorter columns. For type = "rbind", this fills missing columns in shorter rows. Accepts any R object (e.g., numeric, character, logical). Defaults to NA.

Value

A matrix.

Author(s)

Hwanggyu Lim hglim83@gmail.com

Examples

# sample list
score_list <- list(item1=c(0:3), item2=c(0:2), item3=c(0:5), item3=c(0:4))

# examples
# 1) create a rbind with the sample score list
bind.fill(score_list, type="rbind")

# 2) create a cbind with the sample score list
bind.fill(score_list, type="cbind")

# 3) create a cbind with the sample score list,
#    and fill missing data with 0s.
bind.fill(score_list, type="cbind", fill = 0L)


irtQ documentation built on Sept. 11, 2024, 5:10 p.m.