[R] rbind

Patrick Burns pburns at pburns.seanet.com
Mon Jun 22 10:19:13 CEST 2009


Now that I've actually read the question,
I'm in a better position to answer it.

I have no idea how you are getting the
results that you show, but you can use
'rownames' to set whatever row names you
like.  As in:

rownames(result) <- 1:6

Pat

Patrick Burns wrote:
> I'm guessing that your 'data' and 'data1'
> are just vectors so your 'rbind' command
> returns a 2 by 3 matrix.
> 
> Jim showed you already that:
> 
> rbind(as.matrix(data), as.matrix(data1))
> 
> will probably get you what you are looking
> for.
> 
> However, I'm suspicious that just:
> 
> c(data, data1)
> 
> will serve you just as well.  What are you
> planning on doing with a one-column matrix?
> 
> 
> 
> Patrick Burns
> patrick at burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of "The R Inferno" and "A Guide for the Unwilling S User")
> 
> Xiaogang Yang wrote:
>> Hi,
>> I have a array like this
>> data:
>> 1  5
>> 2  2342
>> 3 33
>> and another
>> data1:
>> 1 6
>> 2 5
>> 3 7
>>  when I do rbind(data,data1)
>> I get not what I want
>>  they become
>> 1 5
>> 2 2342
>> 3 33
>> 101 6
>> 102 5
>> 103 7
>>
>>
>>
>>
>> but I want to make the index as increasing one by one.
>> like
>> 1 ..
>> 2 ..
>> 3 ..
>> 4 ..
>> 5 ..
>> 6 ..
>>
>> So what command I should use
>>
>> thank you.
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list