R 给data.frame(dataframe)添加一列

时间:2016-04-10 19:22:56   收藏:0   阅读:695
 x<-data.frame(apple=c(1,4,2,3),pear=c(4,8,5,2))
 x
#  apple pear
# 1     1    4
# 2     4    8
# 3     2    5
# 4     3    2
x$banana<-c(9,5,6,2)
x
#   apple pear banana
# 1     1    4      9
# 2     4    8      5
# 3     2    5      6
# 4     3    2      2

 

原文:http://www.cnblogs.com/emanlee/p/5373599.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!