Skip to content
Snippets Groups Projects
Commit 84fa5ef9 authored by PTobias's avatar PTobias
Browse files

modified to create directories now so anyone can download and run these

parent 2f0ca9e2
No related branches found
No related tags found
No related merge requests found
### FIRST SCRIPT TO CONVRT TO CSV
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015")
library(XLConnect)
dir.create("output/OldName/")
# Import all worksheets and names from a workbook
importWorksheets <- function(filename) {
# filename: name of Excel file
......
##Renaming and cleaning csv files
##SECOND SCRIPT: Renaming and cleaning csv files
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015")
library(zoo)
dir.create("output/NewName/")
rename = function(filename, output = NULL) {
if(!is.null(output)) {
x = read.csv(filename, header = FALSE, stringsAsFactors = FALSE)
......@@ -27,7 +28,7 @@ rename = function(filename, output = NULL) {
}
}
#rename("output/OldName/1_2015-V2-Population-Household-Distribution.xls2.2.b.csv", "output/test/")
#rename("output/OldName/1_2015-V2-Population-Household-Distribution.xls2.2.b.csv", "output/OldNames/")
rename_all = function(pattern) {
data_dir = "output/OldName/"
......
## collapse first two rows into one and designate as header
## THIRD SCRIPT: collapse first two rows into one and designate as header
setwd("~/ownCloud/Timor-Leste/Data/Population/Census_2015/output/NewName")
dir.create("Final/")
collapseHead=function(filename, output = NULL) {
if(!is.null(output)) {
#collapsing first two rows
......
## using collapseHeader to do a final 2 heading collapse for datasets that still have two headings
## FOURTH SCRIPT: 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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment