Function
コメント・参照等
function (download_folder)
{
lapply(c("XLConnect"), require, character.only = T)
path_to_folder <- paste0("C:/Users/", Sys.info()["user"], download_folder)
setwd(path_to_folder)
xls_file <- dir()
buf0 <- readWorksheetFromFile(xls_file, sheet = 1, check.names = F, header = F)
sheet_title <- buf0[1, 1]
print(sheet_title)
buf1 <- f_remove_blank_row_and_column(df = buf0)
buf2 <- f_fill_cells_column_direction(df = buf1, row = 2)
colnames(buf2) <- gsub("^\\s*", "", paste0(buf2[2, ], ":", buf2[3, ]))
DUC <- buf2[-c(1:3), ]
DUC[, 1] <- as.Date(DUC[, 1], tz = "Japan")
colnames(DUC)[1] <- "Date"
DUC[, -1] <- apply(DUC[, -1], 2, function(x) as.numeric(gsub(",", "", x)))
row.names(DUC) <- NULL
return(DUC)
}