[R] Row wise function call.

From: Vasundhara Akkineni <vasu.akkineni_at_gmail.com>
Date: Thu 01 Dec 2005 - 11:01:09 EST


I have another issue.i have a function which calculates the log2(col i /col2) value, where i stands for columns 3,4,...etc.

data<-read.table("table.txt", header=TRUE)

iratio<-function(x){
for(n in 3:ncol(data)){
z<-log2(data[x,n]/data[x,2])
}
}

Where x- the row number of the data frame(data).

i want to store the ratios for each row in a object z, which can be accessed outside the function. How can i do this?

Thanks,
Vasu.

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 01 11:05:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:25 EST