如何与打包人员保存Word文档

时间:2019-07-15 11:49:04

标签: r

我想根据region_action_selected对象中包含的区域保存几个Word文档。这是脚本:


fileout <- tempfile(fileext = ".docx",paste(region_actions_select,"_rapport_2018_",format(Sys.time(), "%d%m%y_%H%M%S"),sep=""))


setwd("C:/Users/Documents")

你能帮我吗?

1 个答案:

答案 0 :(得分:0)

我想您有一个数据框,其区域名称如下:

region_action_selected <- data.frame(region = c("USA, Europe, China, Asia"))

根据我的了解,您想编写不同的文件,可以使用如下代码:

for(p in 1:nrow(region_action_selected)){

  filenamenum = paste0("C:/Users/Desktop",region_action_selected$region[p],".docx")

  tempfile(file=filenamenum)
}

请提供示例输入和预期输出来更新您的问题,请帮忙。