dURNr left_join()由rownames [英] dplyr left_join() by rownames

查看:203
本文介绍了dURNr left_join()由rownames的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 dplyrs 函数 left_join 组合两个data.frames。

I'm using the dplyrs function left_join to combine two data.frames.

现在我想使用左边的data.frame中的 rownames 和相应的列手动加入他们在 left_join 的正确数据框架中命名,但是我收到错误:

Now I would like to manually join them by using the rownames in the left data.frame and the appropriate column name in the right data.frame of left_join, but I get the error:


error:unexpected=indplyr :: left_join(x.tsummary,sto.info,
by = c(rownames(x.tsummary)=

Error: unexpected '=' in "dplyr::left_join(x.tsummary, sto.info, by = c(rownames(x.tsummary) ="

我的代码

> dplyr::left_join(x.tsummary, sto.info, by = c(rownames(x.tsummary) = 'Symbol'))

可能在文档中,它说我应该指定列名,但如果我可以加入左边data.frame的rownames,那将是很好的。

Is this even possible? In the documentation it says that I should specify column names, but it would be great if I could join on rownames for the left data.frame.

推荐答案

这是否有帮助?

dplyr::left_join(x.tsummary %>%
                                    mutate(Symbol = rownames(x.tsummary)),
                                 sto.info,
                                 by = 'Symbol')

这篇关于dURNr left_join()由rownames的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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