标签:excel pac 编码 setw ack java pack 新建 names
setwd("C:/Rworkfile") install.packages("readxl") library(readxl) www<-read_excel("www.xls") www table(www[,5]) a1=names(table(www$县编码)) a2=rep("XXXXXXXXXXXXXX",73) a3=rep("XXXXXXXXXXXXXX",11) for (i in 1:73) { a2[i]=as.matrix(www[www$县编码==a1[i],5])[1] a3[i]=as.matrix(www[www$县编码==a1[i],7])[1] } way= paste0("C:/Rworkfile/新建文件夹/",a3,"/",a2,".csv") for (i in 1:73) { write.csv(www[www$县编码==a1[i],1:5],way[i]) } ########使用另一种包############### install.packages("rJava") library(rJava) install.packages("xlsx") library(xlsx) write.xlsx(x,"/Users/ap/Desktop/incometsforecast.xlsx","sheet1")
标签:excel pac 编码 setw ack java pack 新建 names
原文地址:https://www.cnblogs.com/chenlu-vera/p/9337586.html