Hi,

I've written code to extact a pumf file in R, subset it, and weight it 
like you would do in SPSS. My code is below & it works great. My question 
is: how do i then calculate the frequencies of smokers (1) versus 
non-smokers (2) after having weighted my file? or even the process that 
SPSS is going through to aggregate the data?

Thanks,

Nat


Here is my code:

myfile<-("c:/test2.txt") 
mysubset<-myfile
mysubset$Y_Q02 <-mysubset$DVSELF <-NULL
mysubset2<-mysubset
mysubset2$Y_Q10B <-mysubset2$GP2_07 <-NULL

myVariableNames<-c("PUMFID","PROV","REGION","GRADE","Y_Q10A","WTPP")
myVariableWidths<-c(5,2,1,2,1,12.4)


mysubset2<-read.fwf( 
file=myfile, 
width=myVariableWidths, 
col.names=myVariableNames, 
row.names="PUMFID", 
fill=TRUE, 
strip.white=TRUE) 



print(mysubset2)

happyguys<-subset(mysubset2, PROV==48 & GRADE == 7  & Y_Q10A < 9)
print(happyguys)

 data.frame<-happyguys


> df<-data.frame(PROV,REGION,GRADE,Y_Q10A,WTPP)
> df1 <- df[, 1:4] * df[, 5]
> print(df1)





------------------------------------------------------------------------------------------------------------------------ 

This communication is intended for the use of the recipient to which it is 
addressed, and may
contain confidential, personal, and or privileged information. Please 
contact the sender
immediately if you are not the intended recipient of this communication, 
and do not copy,
distribute, or take action relying on it. Any communication received in 
error, or subsequent
reply, should be deleted or destroyed.
	[[alternative HTML version deleted]]

