R语言怎么将数据框数据导出csv格式

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_42099676/article/details/80918374

store_name <- c("A","B","C","A","B","C")
ip <- c("ai","bi","ci","ai","bi","ci")
date <- c(11,11,11,12,12,12)
open <- c(5,5,5,5,5,5)
pos <- c(23,34,34,56,78,79)
store <- data.frame(store_name,ip,date,open,pos)

commi_name <- c("A1","A2","B1","B2","C1","C2","A1","A2","B1","B2","C1","C2")
store_name <- c("A","A","B","B","C","C","A","A","B","B","C","C")
date <- c(11,11,11,11,11,11,12,12,12,12,12,12)
p <- c(12,14,15,32,43,5,4,435,65,23,32,34)
sale <- c(56,76,34,5968,34,76,92,32,6745,2434,56,23)
commi <- data.frame(commi_name,store_name,date,p,sale)

t = merge(store, commi, all=TRUE, sort=TRUE) 

先建立了两个数据框,然后又合并在了一起,然后再导出

write.table(t,"t1.csv",row.names=FALSE,col.names=TRUE,sep=",")

这样导出的数据是,数据框的行序号是不会导出的

 

 

展开阅读全文

没有更多推荐了,返回首页