R语言函数循环导入excel

2021-11-19  本文已影响0人  lucier19981

个股明细批量导入

udf_DT_stock <- function(new_table = stock_day_all ,
source_tb_name = "stock_day_all",
date_init_mark = "20211108",
date_mark_str = date_definite_list){
new_table <- udf_DT(paste0(path_invest,source_tb_name,date_init_mark,".xlsx"))[0] # 数据末班导入
new_table <- new_table[,stock_day:=""]

for (i in (1:length( date_mark_str )) ){ # 导入100日数据
new_table <- rbind(new_table,
cbind(udf_DT(paste0(path_invest,"stock_day_all",date_mark_str[i],".xlsx")),
stock_day= as.character(date_mark_str[i]) ) )
}
return(new_table) # 循环导入
}

上一篇下一篇

猜你喜欢

热点阅读