Learn R Programming

astrochron (version 1.4)

cb: Combine multiple vectors

Description

Bind two vectors together and return result as a data frame. Alternatively, extract specified columns from a data frame, bind them together, and return result as a data frame.

Usage

cb(a,b)

Arguments

a

first input vector OR a data frame with >1 column.

b

second input vector OR if a is a data frame with > 1 column, a list of columns to bind.

Examples

Run this code
# example dataset
x<-rnorm(100)
dim(x)<-c(10,10)
x<-data.frame(x)

# bind two columns
cb(x[1],x[5])

# bind five columns
cb(x,c(1,2,4,7,9))

Run the code above in your browser using DataLab