Created
January 2, 2014 22:00
-
-
Save dmarcelinobr/8227802 to your computer and use it in GitHub Desktop.
This piece loops text files, read them, merge them, and write back a file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path = "~/Documents/My Data/BRAZIL/Elections/" | |
out.file<-"" | |
file.names <- dir(path, pattern =".txt") | |
for(i in 1:length(file.names)){ | |
file <- read.table(file.names[i],header=TRUE, sep=";", stringsAsFactors=FALSE) | |
out.file <- rbind(out.file, file) | |
} | |
write.table(out.file, file = "cand_Brazil.txt",sep=";", | |
row.names = FALSE, qmethod = "double",fileEncoding="windows-1252") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!