[R] How to use same function for diffrent input values
b.rowlingson at lancaster.ac.uk
Fri Feb 19 09:30:20 CET 2010
On Fri, Feb 19, 2010 at 8:20 AM, Madhavi Bhave <madhavi_bhave at yahoo.com> wrote:
> rates = indiv_rate(n = read.csv('number.csv')$n, rate_name = read.csv('rate.csv')$rate_name, rate = read.csv('rate.csv')$rate, rate_rf1 = read.csv('rate_rf.csv')$rate_rf1,
> rate_rf2 = read.csv('rate_rf.csv')$rate_rf2, rate_rf3 = read.csv('rate_rf.csv')$rate_rf3,
> rateprob1 = read.csv('rate_probability.csv')$probability1, rateprob2 = read.csv('rate_probability.csv')$probability2, rateprob3 = read.csv('rate_probability.csv')$probability3)
I'm not sure I understand your question fully, but this example above
shows me you have a few other things to learn. Don't do the same thing
more than once. Here you are reading the csv files several times.
That's horribly inefficient. Do it once, and store the value in a
rateprobthing = read.csv('file.csv')
and then use 'rateprobthing$whatever' each time. It'll make your code
faster and easier to understand.
For your question about different rates and whatnot, I don't think
it's clear where your different rates come from - is it a whole
different set of .csv files?
More information about the R-help