Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filenames <- list.files(pattern="^.*\\.txt$")
- rec <- list()
- l <- 1
- for(i in 1:length(filenames))
- {
- records <- filenames[i]
- a <- readLines(records)
- head <- unlist(strsplit(a[1], "\t"))
- for(j in 2:length(a))
- {
- line <- unlist(strsplit(a[j], "\t"))
- rec[["noOfCols"]][l] <- length(line)
- for(k in 1:length(head))
- {
- rec[[head[k]]][l] <- line[k]
- }
- l <- l+1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement