Is there a better way to do the following? I have data in a number of tab
delimited files. I am using read.delim() to read them, in a loop. I am
invoking my code on Linux Fedora 20, from the BASH command line, using
Rscript. The code I'm using looks like:

arguments <- commandArgs(trailingOnly=TRUE);
# initialize the capped_data data.frame
capped_data <- data.frame(lpar="NULL",
                       started=Sys.time(),
                       ended=Sys.time(),
                       stringsAsFactors=FALSE);
# and empty it.
capped_data <- capped_data[-1,];
#
# Read in the data from the files listed
for (file in arguments) {
    data <- read.delim(file,
                    header=FALSE,
                    col.names=c("lpar","started","ended"),
                    as.is=TRUE,
                    na.strings='\\N',
                    colClasses=c("character","POSIXct","POSIXct"));
    capped_data <- rbind(capped_data,data)
}
#

I.e. is there an easier way than doing a read.delim/rbind in a loop?


-- 
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to