The problem turned out to be forgetting to use first=T when
loading the resample library. Hence the ordinary version of mean
was used, instead of the version from the resample library (that
supports weights).
Newer versions of the resample library are more forgiving; they
will move themselves to the right spot if you forget to specify first=T.
Download info at bottom.
Tim
>I am using S+ v6.2 on Windows XP
>Could anybody comment on this problem I encounter using groupMeans?
>
>> library(resample,first=T)
>> options(conflicts.ok=T)
>> x
> [,1] [,2]
>[1,] 3217.391 2
>[2,] 4357.143 2
>[3,] 3692.308 2
>[4,] 4000.000 2
>[5,] 11250.000 1
>[6,] 11111.111 1
>[7,] 7600.000 1
>> v <- groupMeans(x[,1],x[,2])
>Problem in mean: argument weights= not matched: mean(x[i], weights =
>weights[i], na.rm = na.rm)
>...
========================================================
| Tim Hesterberg Research Scientist |
| timh@insightful.com Insightful Corp. |
| (206)802-2319 1700 Westlake Ave. N, Suite 500 |
| (206)283-8691 (fax) Seattle, WA 98109-3012, U.S.A. |
| www.insightful.com/Hesterberg |
========================================================
Download the S+Resample library from www.insightful.com/downloads/libraries
Two Research Scientist positions:
data mining
frailty/mixed effects
http://www.insightful.com/company/jobs.asp
|