R中的rbind给出了一个奇怪的行名 [英] rbind in R gives a weird rowname

查看:288
本文介绍了R中的rbind给出了一个奇怪的行名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下数据框架 tt1

> tt1[2,]
        date  close emp pred
2 1982-03-24 112.97  -1    1

和数据框 tt2

> tt2[2,]
        date  close emp pred
2 1982-03-25 113.21   1    1

当我尝试使用 rbind()我得到第二行奇怪的行名。

when I try to use rbind() I get weird row name for the 2nd row.

> rbind(tt1[2,],tt2[2,])
         date  close emp pred
2  1982-03-24 112.97  -1    1
21 1982-03-25 113.21   1    1

任何线索必须如何摆脱它有1,2

any clue has to how to get rid of that have it as 1, 2

推荐答案

尝试

rownames(mydataframe) <- NULL

请参阅文档(键入?rownames 在提示符下)获取更多信息。

See the documentation (type ?rownames on the prompt) for more info.

这篇关于R中的rbind给出了一个奇怪的行名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆