[R] Efficient Way to gather data from various files
ruipbarradas at sapo.pt
Wed Oct 3 03:17:46 CEST 2012
There are more R friendly ways to do what you want, it seems to me easy
to avoid loops but you need to tell us how do you know which rows
correspond to the 50th and 90th quantiles. Maybe this comes from the
value in some other column?
Give a bit more complete a description and we'll see what can be done.
Hope this helps,
Em 03-10-2012 00:33, Sam Asin escreveu:
> Sorry if this process is too simple for this list. I know I can do it, but
> I always read online about how when using R one should always try to avoid
> loops and use vectors. I am wondering if there exists a more "R friendly"
> way to do this than to use for loops.
> I have a dataset that has a list of "ID"s. Let's call this dataset "Master"
> Each of these "ID"s has an associated DBF file. The DBF files each have
> the same title, and they are each located in a directory path that
> includes, as one of the folder names, the "ID".
> These DBF files have 2 columns of interest. One is the "run number" the
> other is the "statistic." I'm interested in the median and 90th percentile
> of the "statistic" as well as their corresponding run numbers. Ultimately,
> I want a table that consists of
> ID Run_50th Stat_50 Run_90 Stat_90
> 1AB 5 102010 3 144376
> 1AC 3 999999 6 999999999
> Where I currently have a dataset that has
> And there are several DBF files that are in folders i.e.
> This dbf looks like
> run Stat
> 1 10
> 2 10
> 3 999999
> 4 100000000000
> 5 100000000
> 6 9999999999
> 7 100000000
> 8 10
> 9 10
> 10 10
> 11 1000000
> I know i could do this with a loop, but I can't see the efficient, R way.
> I was hoping that you experienced R programmers could give me some
> pointers on the most efficient way to achieve this result.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help