Learn R Programming

Jmisc (version 0.3.1.1)

addCol: Add a constant column to a data.frame or matrix

Description

Add a constant column to data.frame or matrix.

Usage

addCol(x, ..., value)

Arguments

x

data.frame or matrix

...

constants

value

vector a vector of constants

Value

a data.frame or matrix contains all columns in x and those constant columns.

Examples

Run this code
# NOT RUN {
d=data.frame(x=1:5,y=11:15)
addCol(d,a=1,b=2,c=3)
addCol(d,value=c(a=100,b=200,c=300))
# }

Run the code above in your browser using DataLab