
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.
cb(a,b)
first input vector OR a data frame with >1 column.
second input vector OR if a is a data frame with > 1 column, a list of columns to bind.
# 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