Created
January 27, 2016 00:08
-
-
Save Eflores89/f993474caff7b4bcdee2 to your computer and use it in GitHub Desktop.
imports
This file contains hidden or 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
docs <- "C:/path/R Data Files" | |
a <- list.files(docs)[grepl(pattern = ".Rdata$", x = list.files(docs))] | |
n <- length(archivos) | |
loadRData <- function(fileName){ | |
#loads an RData file, and returns it | |
load(fileName) | |
get(ls()[ls() != "fileName"]) | |
} | |
full_debate <- NULL | |
for (i in 1:n){ | |
t_debate <- loadRData((paste0(docs,"/",a[i]))) | |
ln <- length(names(t_debate)) | |
print(paste0("Debate #",a[i], " imported. ", ln, " columns")) | |
if(ln == 6){ | |
message <- t_debate$message | |
# clean some inconsistencies in debate message | |
# the "-" at the start... | |
message <- gsub(pattern = "^-", replacement = "", x = message) | |
# change the first person | |
if(t_debate$person[1]==""){t_debate$person[1]<-"DEBATE_DESC"}else{} | |
full_debate <- rbind(full_debate, t_debate) | |
print(paste0(a[i], " binded.")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment