Dear R helpers
 
I have written some function (the actual code I have pasted at the end of mail) 
like say
 
indiv_rate = function(n, rate_name, rate, rate_rf1, rate_rf2, rate_rf3, 
rateprob1, rateprob2, rateprob3)

{
........some R commands
 
return(data.frame(rate_name, rates = round(rate_data, digits = 4)))
 
}
 
## INPUT
 
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)
 
 
## OUTPUT
 
write.csv(data.frame(rates), 'indiv rates generated.csv', row.names = FALSE)

##_______ end of code ____________________________________________________
 
So for given rate (which I am deining as rate = read.csv('rate.csv')$rate), I 
get the desired results.
 
My problem is how do I use this fuction for different 'rates' i.e. for any 
given rate, I run the function and store the result with the respective rate 
name?
 
Regards
 
Madhavi
 
(PS - I am avoiding to paste my actual code consuming 60 lines. Still, if 
somene insists, I can post the same)
 
 
 


      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
        [[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