I have filenames named <InputData>.<TestName>.csv
and I'd like to make graphs for each test. The best way I can see to do this is to make one R table for each TestName. Each test produces the same columns of data, so I'd like to pull in all the data for each test into an R datatable with an extra column for the inputdata.
I'd like to do:
read.tables(c("B217.SE.csv", "C10.SE.csv"), sep=",")
produces (for example):
Filename col1 col2
1 B217.SE.csv 1 2
2 B217.SE.csv 2 4
3 C10.SE.csv 3 1
4 C10.SE.csv 4 5
What's the right way to do this? Some existing function I don't know about? Writing it out in the R language using a for loop?
I can't test it on your data, but you will want to use an
apply
type function like this:Or, you can simplify it by using
plyr
. Here's a rough simulation of how that would work (using data frames instead of files):In this case I will use
get
instead ofread.csv
:Edit
Taking Marek's suggestion, you can either overwrite or create your own function:
Try this: