From: PvR <pvremort_at_vub.ac.be>

Date: Sun 18 Jul 2004 - 21:17:42 EST

R-help@stat.math.ethz.ch mailing list

https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Jul 18 21:40:49 2004

Date: Sun 18 Jul 2004 - 21:17:42 EST

I am *completely* lost in trying to solve a relatively simple task.

I have the occurences of the events in a table 'tt'

0 2 10 11 13 14 15

15 6 1 3 8 15 10

.. meaning that event of type '0' occurs 15 times, type '2' occurs 6 times etc.

0 1 2 10 11 12 13 14 15

817 119 524 96 700 66 559 358 283

Saying that event type '0' occurred 817 times, type '1' occurs 119 times etc.

I have tried programming this as follows:

for( i in 1:length(tt) ) { #loop over smallest table tt

print("i:"); #index print(i); print( "denominator "); #corresponds to the "1" in the example print( df$Freq[i] ); denomtag = ( df$Var1[ i ] ); # corresponds to the "10" in the example, being the type number of the event print("denomtag "); print( denomtag ); print( "nominator: " ); print( df2[2][ df[1] == as.numeric(denomtag) ] ); #this fails .... #result would then be somthing like : denomitor / nominator}

The problem is that the factor names that are extracted in 'denomtag' are not usable as index in the dataframe in the last line. I have tried converting to numeric using 'as.numeric', but that fails since this returns the index in the factor rather then the factor name I need from the list.

Any suggestions .. ? I am sure its dead simple, as always.

Thanks,

Piet (Belgium)

PS: please reply to pvremortNOSPAM@vub.ac.be

R-help@stat.math.ethz.ch mailing list

https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Jul 18 21:40:49 2004

*
This archive was generated by hypermail 2.1.8
: Fri 18 Mar 2005 - 02:36:42 EST
*