In my original message I suggested:
> density <- c(1:length(a))
>
>#creates vector of bin contents
>
> for(i in 1:length(a)) {
>
> density[i] <- sum( w8s[a[i] < x & x <= b[i] ] )
>/ sum(w8s)
>
> }
>
>#weights data in bins
Had I been wider awake this morning I would have recalled that "density" is
an S-Plus function; the code I actually tested had the rather uninformative
"result" in its place.
Moral; if it ain't broke, don't fix it.
Julian Wells
OU Business School
The Open University
Walton Hall
Milton Keynes
MK7 6AA
United Kingdom
+44 1908 654658
|