Hackmageddon_Parser.R
1.11 KB
#------------------------------------------------------------------------------------------------------
#-----------------------------Parser Excel - ISO survey------------------------------------------------
#------------------------------------------------------------------------------------------------------
ParseHMExcel <- function(file){
print(file)
if (!file.exists(file)) {
stop(paste("Error, file [", file, "] not found"))
}
dataset <- read.xlsx2(file, 1, header = TRUE,colIndex = 2:10, colClasses = c("Date", "character", "character", "character", "character", "character", "character", "character"))
dataset
}
ProccesHMRaw <- function(dataset.raw){
#Remove rows with Date NA
dataset <- dataset.raw[!is.na(dataset.raw$Date),]
dataset
}
ParseHMFolder <- function(folder){
filelist <- list.files(folder)
#frames <- lapply(paste(folder,filelist,sep = ""),ParseHMExcel)
dataset <- ProccesHMRaw(ParseHMExcel(paste(folder,filelist[1],sep = "/")))
for (i in 2:length(filelist)) {
dataset <- rbind(dataset, ProccesHMRaw(ParseHMExcel(paste(folder,filelist[i],sep = "/"))))
}
dataset
}