我有一个数组,其中包含每个条目的数据框(数据框有列' hospital'和#39;状态'):
> groups
$AK
hospital state
AK NA AK
$AL
hospital state
AL D W MCMILLAN MEMORIAL HOSPITAL AL
$AR
hospital state
AR ARKANSAS METHODIST MEDICAL CENTER AR
当我调用unsplit
方法时,我无法获得正确统一的数据框:
> unsplit(groups, dimnames(groups) )
hospital state
AK <NA> AK
AL D W MCMILLAN MEMORIAL HOSPITAL <NA>
AR ARKANSAS METHODIST MEDICAL CENTER <NA>
Warning messages:
1: In `[<-.factor`(`*tmp*`, iseq, value = "AL") :
: invalid factor level, NAs generated
2: In `[<-.factor`(`*tmp*`, iseq, value = "AR") :
: invalid factor level, NAs generated
它让我坚持了好几个小时。如何正确重新统一数据框?
由于