paste column values to another column

安稳与你 提交于 2019-12-01 21:00:56

You could use paste or paste0, but I find sprintf easier to read

sprintf("%i(.%i)", dta1$x, round(100*dta1$y))

where %i marks integer numbers given in the following arguments (dta1$x and so on).

You just need to trim the string and combine with paste, so something like:

paste0(x, "(", substr(y, 2, nchar(y)), ")")

will give you what you are after

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!