Hi Michael and Sarah,
 
Thank you for offering help. I finally managed to construct an example with all 
essentials of my problem: 
 
x1<-c(1,2,3,4)
x2<-c(2,3,4,5)
x3<-c(3,4,5,6)
x<-rbind(x1,x2,x3)
time<-c(1,3,9)
fit<-function(xx,t,tcc){slope <- coefficients(lm(log(xx) ~ 0 + t))[1]
alpha<-slope-log(2)/tcc
return(alpha)
}
alpha<-fit(x,time,20)
 
At the moment the function output 'alpha' is calculated for x(x1=1,x2=2,x3=3). 
I would like to get 'alphas' for all four rows of x without using a for-loop. 
Is there any possibility to avoid a for-loop?
 
Thank you very much in advance,
Stella


Von: Sarah Goslee <sarah.gos...@gmail.com>
An: R. Michael Weylandt <michael.weyla...@gmail.com> 
CC: stella <dorotheabu...@yahoo.de>; r-help@r-project.org 
Gesendet: 17:14 Donnerstag, 22.März 2012
Betreff: Re: [R] How to get the input of a function right?

On Thu, Mar 22, 2012 at 11:55 AM, R. Michael Weylandt
<michael.weyla...@gmail.com> wrote:
> This is quite difficult without being able to see the function f .....
>
> Michael

I thought we had a fortune about telepathy, but I can't find it in the
fortunes package.

Sarah
-- 
Sarah Goslee
http://www.functionaldiversity.org
        [[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