rbind(x1, x2, ..., deparse.level = 1)
x1,x2, ...
: vector, matrix, data frames
deparse.level
: for non matrix, 0 constructs no labels, 1 or 2 constructs labels from the argument names
data1.csv:
data2.csv:
Read in the data from the file:
>x <- read.csv("data1.csv",header=T,sep=",") >x2 <- read.csv("data2.csv",header=T,sep=",")
>x3 <- rbind(x,x2) >x3
Subtype Gender Expression 1 A m -0.54 2 A f -0.80 3 B f -1.03 4 C m -0.41 5 D m 3.22 6 D f 1.02 7 D f 0.21 8 D m -0.04 9 D m 2.11 10 B m -1.21 11 A f -0.20
The column numbers of the two datasets must be the same, otherwise the combination will be meaningless.
> x <- 1:5 > x[1] 1 2 3 4 5 > y <- 9 > rbind(x,y)[,1] [,2] [,3] [,4] [,5] x 1 2 3 4 5 y 9 9 9 9 9
The row names of the result can be determined by deparse.level value. The default value of deparse.level is 1:
> rbind(x,y,3,z=12)[,1] [,2] [,3] [,4] [,5] x 1 2 3 4 5 y 9 9 9 9 9 3 3 3 3 3 z 12 12 12 12 12 > rbind(x,y,3,z=12,deparse.level=0)[,1] [,2] [,3] [,4] [,5] 1 2 3 4 5 9 9 9 9 9 3 3 3 3 3 z 12 12 12 12 12 > rbind(x,y,3,z=12,deparse.level=2)[,1] [,2] [,3] [,4] [,5] x 1 2 3 4 5 y 9 9 9 9 9 3 3 3 3 3 3 z 12 12 12 12 12