How to copy row from one data.frame in to another [R]

橙三吉。 提交于 2019-12-05 07:05:00

Your example happens to pretty much answer your question. (Try it out!)

If, instead of replacing a row in the target data.frame, you want to add a row to it, try rbind() instead:

X <- data.frame(name=LETTERS[1:3], value=1:3, stringsAsFactors=FALSE)
Y <- data.frame(name=letters[1:3], value=rnorm(3), stringsAsFactors=FALSE)

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