I think my question is very simple.
dat1<-seq(1:100)
dat2<-seq(1:100)
how can I combine dat1 and dat2 and make it l开发者_开发问答ook like
dat3<-seq(1:200)
Thanks so much!
How do you want to combine dat1
and dat2
? By rows or columns? I'd take a look at the help pages for rbind()
(row bind) , cbind()
(column bind), orc()
which combines arguments to form a vector.
Let me start by a comment.
In order to create a sequence of number on can use the following syntax:
x <- seq(from=, to=, by=)
A shorthand for, e.g., x <- seq(from=1, to=10, by=1)
is simply 1:10
. So, your notation is a little bit weird...
On the other hand, you can combine two or more vectors using the c()
function. Let us say, for example, that a <- c(1, 2)
and b <- c(3, 4)
. Then c <- c(a, b)
is the vector (1, 2, 3, 4)
.
There exist similar functions to combine data sets: rbind()
and cbind()
.
精彩评论