[R] Prorating scale items

John Kane jrkrideau at yahoo.ca
Fri Nov 30 17:53:59 CET 2007


There probably is a better way to do this but I'd
suggest getting an overall total and then splitting
the data.frame into it's 3  component parts then apply
the equations below to get the sums and the number of
missing values for each subject over all four
data.frames.  
=================================================
apply(dd, 1, sum, na.rm=TRUE)# sum of responses

count.NAS=function(x) length(which(is.na(x)))  #from
J. Valbuena 
apply(dd,1,count.NAS) # number of NA's per subject

==================================

Then prorate for each of the four data.frames.

I hope this makes sense.

--- Bob Green <bgreen at dyson.brisnet.org.au> wrote:

> Hello,
> 
> I am hoping for some advice as to how I can prorate
> a number of scale
> items that comprise a score. At least 69 of 159
> cases have at least 1
> value missing (65 cases have H7 missing). The
> maximum number of missing is
> 5.
> 
> I want to compute a total score, a score for the H
> items, the R items and
> C items.
> 
> H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, C1, C2, C3,
> C4, C5, R1, R2, R3,
> R4, R5
> 
> I am uncertain as to whether a series of IF
> statements are required or
> some other strategy. Prorating is the method a
> researcher using this scale
> has recommended.
> 
> Any advice is appreciated,
> 
> Bob Green
> 
> ______________________________________________
> R-help at 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.
> 



[[replacing trailing spam]]



More information about the R-help mailing list