Skip to content
Snippets Groups Projects
Commit 77b9c3b8 authored by PTobias's avatar PTobias
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 698 additions and 0 deletions
2015TimorCensus @ a79ad117
Subproject commit a79ad117c38bd70c5946544b93f00df506c61b13
# this is a draft
data = read.csv("output/1/test/X2.1.a.Table.1.a.Total.population.and.household.type.by.sex.and.Municipality.csv")
dat = z[!2:3,]
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V2")
library(XLConnect)
# Import all worksheets and names from a workbook
importWorksheets <- function(filename) {
# filename: name of Excel file
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
names(sheet_names) <- sheet_names
sheet_list <- lapply(sheet_names, function(.sheet){
readWorksheet(object=workbook, .sheet)})
}
# wb = importWorksheets("1_2015-V2-Population-Household-Distribution.xls")
#working on reading in multiple files
# wbs = list.files(pattern = "*.xls")
# creating a function to get sheet names
# newfilename = function(filename) {
# workbook <- loadWorkbook(filename)
# sheet_names <- getSheets(workbook)
# }
# write csv for second sheet with sheet name
# write.csv(wb[2], sheet_names[2])
# and third
# write.csv(wb[3], sheet_names[3])
#writting csv files from one Excel workbook
csv = function(filename, output = NULL) {
#input:
# filename: character string of a xls file name
# output: character string of the saved csv
wb = importWorksheets(filename)
if(!is.null(output)) {
for (x in seq_along(wb)) {
# getting sheet names (to write csv with sheet name)
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
#writing csv with sheet names as filename
write.csv(wb[x], file = paste(output,sheet_names[x], ".csv", sep = ""))
}
}
#if(!is.null(output)) {
#dev.off()
#}
}
csv_all = function(pattern) {
dir = "V2_csvoutput/"
filenames = list.files(pattern = pattern)
for (f in filenames) {
csv_name = paste(dir,f,sep="")
csv(f, output = csv_name)
}
}
csv_all('*.xls')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V3")
library(XLConnect)
# Import all worksheets and names from a workbook
importWorksheets <- function(filename) {
# filename: name of Excel file
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
names(sheet_names) <- sheet_names
sheet_list <- lapply(sheet_names, function(.sheet){
readWorksheet(object=workbook, .sheet)})
}
# wb = importWorksheets("1_2015-V2-Population-Household-Distribution.xls")
#working on reading in multiple files
# wbs = list.files(pattern = "*.xls")
# creating a function to get sheet names
# newfilename = function(filename) {
# workbook <- loadWorkbook(filename)
# sheet_names <- getSheets(workbook)
# }
# write csv for second sheet with sheet name
# write.csv(wb[2], sheet_names[2])
# and third
# write.csv(wb[3], sheet_names[3])
#writting csv files from one Excel workbook
csv = function(filename, output = NULL) {
#input:
# filename: character string of a xls file name
# output: character string of the saved csv
wb = importWorksheets(filename)
if(!is.null(output)) {
for (x in seq_along(wb)) {
# getting sheet names (to write csv with sheet name)
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
#writing csv with sheet names as filename
write.csv(wb[x], file = paste(output,sheet_names[x], ".csv", sep = ""))
}
}
#if(!is.null(output)) {
#dev.off()
#}
}
csv_all = function(pattern) {
dir = "V3_csvoutput/"
filenames = list.files(pattern = pattern)
for (f in filenames) {
csv_name = paste(dir,f,sep="")
csv(f, output = csv_name)
}
}
csv_all('*.xls')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V4")
library(XLConnect)
# Import all worksheets and names from a workbook
importWorksheets <- function(filename) {
# filename: name of Excel file
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
names(sheet_names) <- sheet_names
sheet_list <- lapply(sheet_names, function(.sheet){
readWorksheet(object=workbook, .sheet)})
}
# wb = importWorksheets("1_2015-V2-Population-Household-Distribution.xls")
#working on reading in multiple files
# wbs = list.files(pattern = "*.xls")
# creating a function to get sheet names
# newfilename = function(filename) {
# workbook <- loadWorkbook(filename)
# sheet_names <- getSheets(workbook)
# }
# write csv for second sheet with sheet name
# write.csv(wb[2], sheet_names[2])
# and third
# write.csv(wb[3], sheet_names[3])
#writting csv files from one Excel workbook
csv = function(filename, output = NULL) {
#input:
# filename: character string of a xls file name
# output: character string of the saved csv
wb = importWorksheets(filename)
if(!is.null(output)) {
for (x in seq_along(wb)) {
# getting sheet names (to write csv with sheet name)
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
#writing csv with sheet names as filename
write.csv(wb[x], file = paste(output,sheet_names[x], ".csv", sep = ""))
}
}
#if(!is.null(output)) {
#dev.off()
#}
}
csv_all = function(pattern) {
dir = "V4_csvoutput/"
filenames = list.files(pattern = pattern)
for (f in filenames) {
csv_name = paste(dir,f,sep="")
csv(f, output = csv_name)
}
}
csv_all('*.xls')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015")
library(XLConnect)
# Import all worksheets and names from a workbook
importWorksheets <- function(filename) {
# filename: name of Excel file
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
names(sheet_names) <- sheet_names
sheet_list <- lapply(sheet_names, function(.sheet){
readWorksheet(object=workbook, .sheet)})
}
# wb = importWorksheets("1_2015-V2-Population-Household-Distribution.xls")
#working on reading in multiple files
# wbs = list.files(pattern = "*.xls")
# creating a function to get sheet names
# newfilename = function(filename) {
# workbook <- loadWorkbook(filename)
# sheet_names <- getSheets(workbook)
# }
# write csv for second sheet with sheet name
# write.csv(wb[2], sheet_names[2])
# and third
# write.csv(wb[3], sheet_names[3])
#writting csv files from one Excel workbook
csv = function(filename, output = NULL) {
#input:
# filename: character string of a xls file name
# output: character string of the saved csv
wb = importWorksheets(filename)
gsub(",","",wb)
if(!is.null(output)) {
for (x in seq_along(wb)) {
# getting sheet names (to write csv with sheet name)
workbook <- loadWorkbook(filename)
sheet_names <- getSheets(workbook)
#writing csv with sheet names as filename
df = gsub(",","",wb[x])
write.csv(df, file = paste(output,sheet_names[x], ".csv", sep = ""))
}
}
}
csv_all = function(pattern) {
dir = "output/OldName/"
filenames = list.files(pattern = pattern)
for (f in filenames) {
csv_name = paste(dir,f,sep="")
csv(f, output = csv_name)
}
}
csv_all('*.xls')
## create csv with the volume and table title of each dataset
#need to fix this code, wanting to create a table with two field, one field for Volume headings and the other field for Table headings
#grab Volume heading and enter into a table of its own called "TableNames"
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/output/NewName/Final")
df = data.frame("TableNames" = character(), stringsAsFactors = FALSE)
write.csv(df,"VolumeNames")
grabHeader= function(filename){
dat = read.csv(filename, header = FALSE)
#dat = read.csv("X2.1.b.Table.1.b.Urban.population.and.household.type.by.sex.and.Municipality.csv", header = FALSE)
header = toString(dat[1,1])
volume = gsub(".Table.*", "", header)
#pattern = ".*.Table"
#header = gsub(pattern, "Table", header)
VolNam = read.csv("VolumeNames", header = TRUE, stringsAsFactors = FALSE)
write.csv(rbind(VolNam, volume), "VolumeNames", row.names = FALSE)
}
grabHeader_all= function(pattern){
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
grabHeader(f)
}
}
grabHeader_all("*.csv")
################
#grab Table names and enter into a table of its own called "TableNames"
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/output/NewName/Final")
df = data.frame("TableNames" = character(), stringsAsFactors = FALSE)
write.csv(df,"TableNames")
grabHeader= function(filename){
dat = read.csv(filename, header = FALSE)
#dat = read.csv("X2.1.b.Table.1.b.Urban.population.and.household.type.by.sex.and.Municipality.csv", header = FALSE)
header = toString(dat[1,1])
#volume = sub(".Table.*", "", header)
pattern = ".*.Table"
header = gsub(pattern, "Table", header)
TabNam = read.csv("TableNames", header = TRUE, stringsAsFactors = FALSE)
write.csv(rbind(TabNam, header), "TableNames", row.names = FALSE)
}
grabHeader_all= function(pattern){
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
grabHeader(f)
}
}
grabHeader_all("*.csv")
##Renaming and cleaning csv files
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015")
library(zoo)
rename = function(filename, output = NULL) {
if(!is.null(output)) {
x = read.csv(filename, header = FALSE, stringsAsFactors = FALSE)
newname = x[1,2]
x[3,2] <- x[1,2]
#delete first row and first column that hold legacy names
y=x[2:nrow(x), 2:ncol(x)]
#delete all rows with unwanted words in the second column
dat = y[!grepl("(1)", y$V2, fixed = TRUE),]
dat2 = dat[!grepl("Based", dat$V2, fixed = FALSE),]
dat3 = dat2[!grepl("Special", dat2$V2, fixed = FALSE),]
#delete all 'totals' rows
dat4 = dat3[!grepl("TIMOR-LESTE", dat3$V2, fixed = TRUE),]
dat5 = dat4[!grepl("TOTAL", dat4$V2, fixed = TRUE),]
#to clean all rows complete with NAs
clean = dat5[rowSums(is.na(dat5)) != ncol(dat5),]
#clean up NA with value below
#clean[is.na(clean)] <- 0
cleanNA = t(na.locf(t(clean), fromLast = FALSE))
#final = cleanNA[2:nrow(cleanNA),2:ncol(cleanNA)]
#write 'clean' data with new name
write.table(cleanNA, paste(output,newname,".csv",sep=""), col.names = FALSE, row.names = FALSE, sep=",", na="0")
}
}
#rename("output/OldName/1_2015-V2-Population-Household-Distribution.xls2.2.b.csv", "output/test/")
rename_all = function(pattern) {
data_dir = "output/OldName/"
#results_dir = "output/NewName/"
filenames = list.files(path = data_dir, pattern = pattern)
for (f in filenames) {
rename(file.path(data_dir,f),output = "output/NewName/")
}
}
rename_all("*.csv")
##Renaming and cleaning csv files
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V2")
library(zoo)
rename = function(filename, output = NULL) {
if(!is.null(output)) {
x = read.csv(filename, header = FALSE)
newname = x[1,2]
x[3,2] <- x[1,2]
#delete first row and first column that hold legacy names
y=x[2:nrow(x), 2:ncol(x)]
#delete all rows with "(1)" and "1 SAR" in the second column
dat = y[!grepl("(1)", y$V2, fixed = TRUE),]
dat2 = dat[!grepl("Based", dat$V2, fixed = FALSE),]
dat3 = dat2[!grepl("Special", dat2$V2, fixed = FALSE),]
#delete all 'totals' rows
dat4 = dat3[!grepl("TIMOR-LESTE", dat3$V2, fixed = TRUE),]
dat5 = dat4[!grepl("TOTAL", dat4$V2, fixed = TRUE),]
#to clean all rows complete with NAs
clean = dat5[rowSums(is.na(dat5)) != ncol(dat5),]
#clean up NA with value below
#clean[is.na(clean)] <- 0
cleanNA = t(na.locf(t(clean), fromLast = FALSE))
#final = cleanNA[2:nrow(cleanNA),2:ncol(cleanNA)]
#write 'clean' data with new name
write.table(cleanNA, paste(output,newname,".csv",sep=""), col.names = FALSE, row.names = FALSE, sep=",", na="0")
}
}
#rename("output/OldName/1_2015-V2-Population-Household-Distribution.xls2.2.a.csv", "output/test/")
rename_all = function(pattern) {
data_dir = "V2_csvoutput/"
#results_dir = "output/NewName/"
filenames = list.files(path = data_dir, pattern = pattern)
for (f in filenames) {
rename(file.path(data_dir,f),output = "V2_csvnewname/")
}
}
rename_all("*.csv")
\ No newline at end of file
##Renaming and cleaning csv files
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V3")
library(zoo)
rename = function(filename, output = NULL) {
if(!is.null(output)) {
x = read.csv(filename, header = FALSE)
newname = x[1,2]
x[3,2] <- x[1,2]
#delete first row and first column that hold legacy names
y=x[2:nrow(x), 2:ncol(x)]
#delete all rows with "(1)" and "1 SAR" in the second column
dat = y[!grepl("(1)", y$V2, fixed = TRUE),]
dat2 = dat[!grepl("Based", dat$V2, fixed = FALSE),]
dat3 = dat2[!grepl("Special", dat2$V2, fixed = FALSE),]
#delete all 'totals' rows
dat4 = dat3[!grepl("TIMOR-LESTE", dat3$V2, fixed = TRUE),]
dat5 = dat4[!grepl("TOTAL", dat4$V2, fixed = TRUE),]
#to clean all rows complete with NAs
clean = dat5[rowSums(is.na(dat5)) != ncol(dat5),]
#clean up NA with value below
#clean[is.na(clean)] <- 0
cleanNA = t(na.locf(t(clean), fromLast = FALSE))
#final = cleanNA[2:nrow(cleanNA),2:ncol(cleanNA)]
#write 'clean' data with new name
write.table(cleanNA, paste(output,newname,".csv",sep=""), col.names = FALSE, row.names = FALSE, sep=",", na="0")
}
}
#rename("output/OldName/1_2015-V2-Population-Household-Distribution.xls2.2.a.csv", "output/test/")
rename_all = function(pattern) {
data_dir = "V3_csvoutput/"
#results_dir = "output/NewName/"
filenames = list.files(path = data_dir, pattern = pattern)
for (f in filenames) {
rename(file.path(data_dir,f),output = "V3_csvnewname/")
}
}
rename_all("*.csv")
\ No newline at end of file
##Renaming and cleaning csv files
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V4")
library(zoo)
rename = function(filename, output = NULL) {
if(!is.null(output)) {
x = read.csv(filename, header = FALSE)
newname = x[1,2]
x[3,2] <- x[1,2]
#delete first row and first column that hold legacy names
y=x[2:nrow(x), 2:ncol(x)]
#delete all rows with "(1)" and "1 SAR" in the second column
dat = y[!grepl("(1)", y$V2, fixed = TRUE),]
dat2 = dat[!grepl("Based", dat$V2, fixed = FALSE),]
dat3 = dat2[!grepl("Special", dat2$V2, fixed = FALSE),]
#delete all 'totals' rows
dat4 = dat3[!grepl("TIMOR-LESTE", dat3$V2, fixed = TRUE),]
dat5 = dat4[!grepl("TOTAL", dat4$V2, fixed = TRUE),]
#to clean all rows complete with NAs
clean = dat5[rowSums(is.na(dat5)) != ncol(dat5),]
#clean up NA with value below
#clean[is.na(clean)] <- 0
cleanNA = t(na.locf(t(clean), fromLast = FALSE))
#final = cleanNA[2:nrow(cleanNA),2:ncol(cleanNA)]
#write 'clean' data with new name
write.table(cleanNA, paste(output,newname,".csv",sep=""), col.names = FALSE, row.names = FALSE, sep=",", na="0")
}
}
#rename("output/OldName/1_2015-V2-Population-Household-Distribution.xls2.2.a.csv", "output/test/")
rename_all = function(pattern) {
data_dir = "V4_csvoutput/"
#results_dir = "output/NewName/"
filenames = list.files(path = data_dir, pattern = pattern)
for (f in filenames) {
rename(file.path(data_dir,f),output = "V4_csvnewname/")
}
}
rename_all("*.csv")
\ No newline at end of file
#check datasets to see if headers have been collapsed into one heading (and there is no '0' in the cell[2,1])
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/output/NewName/Final")
df = data.frame("Sheet has 0 in cell[2,1]" = character(), stringsAsFactors = FALSE)
write.csv(df, "FinalClean")
cleanCheck = function(filename) {
dat = read.csv(filename, header = FALSE, stringsAsFactors = FALSE)
dat[is.na(dat)] <-0
FinalClean = read.csv("FinalClean", header = TRUE, stringsAsFactors = FALSE)
if(dat[2,1] == 0){
write.csv(rbind(FinalClean,"TRUE"), "FinalClean", row.names = FALSE)
} else {
write.csv(rbind(FinalClean,"FALSE"), "FinalClean", row.names = FALSE)
}
}
#cleanCheck(filename)
cleanCheck_all = function(pattern) {
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
cleanCheck(f)
}
}
cleanCheck_all("*.csv")
## collapse first two rows into one and designate as header
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/output/NewName")
collapseHead=function(filename, output = NULL) {
if(!is.null(output)) {
#collapsing first two rows
data = read.table(filename, skip = 2, sep=",")
labels = read.table(filename, nrows = 2, stringsAsFactors = FALSE, fill = TRUE, sep = ",")
names(data) = sapply(labels, paste, collapse = "_")
x = data[!grepl("TIMOR-LESTE", data[,1]),]
#y = x[!grepl("Total", x[,1]),]
df = x[!grepl("TOTAL", x[,1]),]
df[is.na(df)] <-0
dat = df[rowSums(df != 0) != 0, ]
#write csv
write.table(dat,paste(output, filename,sep=""), col.names = TRUE, row.names = FALSE, sep =",")
}
}
#collapseHead(filename, ".")
#collapseHead("X2.1.a.Table.1.a.Total.population.and.household.type.by.sex.and.Municipality.csv", "Final/")
#collapseHead("X4.11.1.Table.11.1.Number.of.rooms.in.residences.of.private.households..Administrative.Post.and.Suco..Aileu.csv", "Final/")
collapseHead_all = function(pattern) {
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
collapseHead(file.path(".",f),output = "Final/")
}
}
collapseHead_all('*.csv')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V2/V2_csvnewname/")
## collapse first two rows into one and designate as header
collapseHead=function(filename, output = NULL) {
if(!is.null(output)) {
#collapsing first two rows
data = read.table(filename, skip = 2, sep=",")
labels = read.table(filename, nrows = 2, stringsAsFactors = FALSE, fill = TRUE, sep = ",")
names(data) = sapply(labels, paste, collapse = "_")
x = data[!grepl("TIMOR-LESTE", data[,1]),]
#y = x[!grepl("Total", x[,1]),]
z = x[!grepl("TOTAL", x[,1]),]
#write csv
write.table(z,paste(output,filename,sep=""), col.names = TRUE, row.names = FALSE, sep =",")
}
}
#collapseHead("X2.1.a.Table.1.a.Total.population.and.household.type.by.sex.and.Municipality.csv", "Final/")
collapseHead_all = function(pattern) {
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
collapseHead(file.path(".",f),output = "V2_Final/")
}
}
collapseHead_all('*.csv')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V3/V3_csvnewname/")
## collapse first two rows into one and designate as header
collapseHead=function(filename, output = NULL) {
if(!is.null(output)) {
#collapsing first two rows
data = read.table(filename, skip = 2, sep=",")
labels = read.table(filename, nrows = 2, stringsAsFactors = FALSE, fill = TRUE, sep = ",")
names(data) = sapply(labels, paste, collapse = "_")
x = data[!grepl("TIMOR-LESTE", data[,1]),]
#y = x[!grepl("Total", x[,1]),]
z = x[!grepl("TOTAL", x[,1]),]
#write csv
write.table(z,paste(output,filename,sep=""), col.names = TRUE, row.names = FALSE, sep =",")
}
}
#collapseHead("X2.1.a.Table.1.a.Total.population.and.household.type.by.sex.and.Municipality.csv", "Final/")
collapseHead_all = function(pattern) {
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
collapseHead(file.path(".",f),output = "V3_Final/")
}
}
collapseHead_all('*.csv')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/V4/V4_csvnewname/")
## collapse first two rows into one and designate as header
collapseHead=function(filename, output = NULL) {
if(!is.null(output)) {
#collapsing first two rows
data = read.table(filename, skip = 2, sep=",")
labels = read.table(filename, nrows = 2, stringsAsFactors = FALSE, fill = TRUE, sep = ",")
names(data) = sapply(labels, paste, collapse = "_")
x = data[!grepl("TIMOR-LESTE", data[,1]),]
#y = x[!grepl("Total", x[,1]),]
z = x[!grepl("TOTAL", x[,1]),]
#write csv
write.table(z,paste(output,filename,sep=""), col.names = TRUE, row.names = FALSE, sep =",")
}
}
#collapseHead("X2.1.a.Table.1.a.Total.population.and.household.type.by.sex.and.Municipality.csv", "Final/")
collapseHead_all = function(pattern) {
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
collapseHead(file.path(".",f),output = "V4_Final/")
}
}
collapseHead_all('*.csv')
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015")
library(RSQLite)
#filename = "X2.1.b.Table.1.b.Urban.population.and.household.type.by.sex.and.Municipality.csv"
dbInsert = function(filename){
db = dbConnect(SQLite(), dbname = "Census2015.db")
dat = read.csv(paste("output/NewName/Final/",filename, sep = ""))
dat2 = read.csv(paste("output/NewName/Final/",filename, sep = ""), header = FALSE)
header = toString(dat2[1,1])
name = sub(".Table.*", "", header)
dbWriteTable(conn = db, name = name, dat, overwrite = T, row.names = FALSE)
}
#dbInsert("output/NewName/Final/X2.1.b.Table.1.b.Urban.population.and.household.type.by.sex.and.Municipality.csv")
#dat = read.csv("X2.1.b.Table.1.b.Urban.population.and.household.type.by.sex.and.Municipality.csv", header = FALSE)
dbInsert_all = function(pattern) {
filenames = list.files(path = "output/NewName/Final/", pattern = pattern)
for (f in filenames) {
dbInsert(f)
}
}
dbInsert_all("*.csv")
db = dbConnect(SQLite(), dbname = "Census2015.db")
## using collapseHeader to do a final 2 heading collapse for datasets that still have two headings
#filename = "X2.16j.Table.16.j.Age.at.first.marriage.of.persons.aged.over.nine.years.by.age.and.sex..Manatuto.csv"
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/output/NewName/Final")
finalCollapse = function(filename, output) {
if(!is.null(output)) {
dat = read.csv(filename, header = TRUE, stringsAsFactors = FALSE)
#write.csv(dat, filename)
#dat = read.csv(filename, header = FALSE)
#FinalClean = read.csv("FinalClean", header = TRUE, stringsAsFactors = FALSE)
if(dat[1,1] == 0){
data = read.table(filename, skip = 2, sep=",")
labels = read.table(filename, nrows = 2, stringsAsFactors = FALSE, fill = TRUE, sep = ",")
names(data) = sapply(labels, paste, collapse = "_")
write.table(data, paste("./", filename,sep=""), col.names = TRUE, row.names = FALSE, sep =",")
}
}
}
#finalCollapse(filename)
finalCollapse_all = function(pattern) {
filenames = list.files(path = ".", pattern = pattern)
for (f in filenames) {
finalCollapse(f, ".")
}
}
finalCollapse_all("*.csv")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment