From: Renuka Sane <renukas_at_gmail.com>

Date: Mon 18 Jul 2005 - 19:38:05 EST

A. P., Urban, 0

...

......

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 Mon Jul 18 19:44:23 2005

Date: Mon 18 Jul 2005 - 19:38:05 EST

For example

C

state, psu,weight

A. P., Urban, 0

Mah., Rural, 0 W.B., Rural,0 Ass., Rural,0 M. P., Urban,0

A. P., Urban, 0

...

C1

state, psu, weight A. P., Urban, 1.3 A. P., Rural, 1.2 M. P., Urban, 0.8

......

For every row of C, I want to check if C$state==C1$state and C$psu==C1$psu. If it is, I want C$weight <- C1$weight, else C$weight should be zero.

I am doing the following

for( i in 1:length(C$weight)) {

C$w[C$state[i]==C1$state & C$psu[i]==C1$psu] <- C1$w[C$state[i] ==
C1$state & C$psu[i] == C1$psu]

}

This gives me the correct replacements for the number of rows in C1 and then just repeats the same weights for the remaning rows in C.

Can someone point out the error in what I am doing or show the correct way of doing this?

Thanks,

Renuka

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 Mon Jul 18 19:44:23 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:33:46 EST
*