Skip to menu

factor 변수 중 한 level의 개수가 0인 경우

 

"Error in names(subgroup) <- rownames(result)

'names' attribute [3] must be the same length as the vector [2]" 가 발생합니다.

 

기존에는 괜찮았었는데 R 업데이트 후 발생합니다.

 

예를 들어 다음과 같은 코드 실행시 에러 발생합니다.

acs%>%

  mutate(Dx=factor(Dx))%>%

  filter(Dx!='STEMI')%>%

mytable(entry~.,data=.)