[R] HMISC package: wtd.table()

Frank E Harrell Jr f.harrell at vanderbilt.edu
Mon Jan 26 16:24:42 CET 2009


Norbert NEUWIRTH wrote:
> oops, that really was easy:
> 
> (wtd.table(FamTyp.kurz,HGEW,normwt=FALSE,na.rm=TRUE))  instead of 
> (wtd.table(FamTyp.kurz,weigths=HGEW,normwt=FALSE,na.rm=TRUE))

That is one solution.  The other is to spell 'weights' correctly :-)
Frank

> 
> sorry for that question ...
> 
> Am 26.01.2009, 10:30 Uhr, schrieb Norbert NEUWIRTH <norbert.s.neuwirth at univie.ac.at>:
> 
>> Hi useRs & developeRs,
>>
>> I got stuck within a function of the Hmisc package. Sounds easy, hope it is:
>>
>> I got 2 items (FamTyp.kurz, HGEW) of same length, no missings.
>>
>>> length(FamTyp.kurz);summary(FamTyp.kurz)
>> [1] 14883
>>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>   10.00   20.00   21.00   21.66   23.00   31.00
>>> length(HGEW);summary(HGEW)
>> [1] 14883
>>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>   104.5   409.6   489.4   549.8   623.3  3880.0
>>
>> Now I simply want to compute a table of unweighted and weighted values. But, ...  the weights do not seem to be accepted ????
>>
>>
>>>   print("unweighted ....");print(table(FamTyp.kurz))
>> [1] "unweighted ...."
>> FamTyp.kurz
>>   10      11    20       21     22      23     30      31
>> 1755  683 3322 1683 2428 1440 1748 1824
>>
>>>   print("weighted   ....");print(wtd.table(FamTyp.kurz,weigths=HGEW,normwt=FALSE,na.rm=TRUE))
>> [1] "weighted   ...."
>> Error in wtd.table(FamTyp.kurz, weigths = HGEW, normwt = FALSE, na.rm = TRUE) :
>>   unused arguments (weigths = c(495.55949, 495.55949, 678.16378, 678.16378,  .....
>>
>>
>> any ideas ???
>>
>> thanx in advance,
>>     Norbert
>>
>>
>>
> 
> 
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list