Skip to menu

mytable 함수 애러

사이 2020.04.08 15:20 Views : 259

안녕하세요. mytable에서 변수 2개를 이용해 표를 만들고 싶은데요, 그 과정에서 계속 애러가 나서 문의드립니다. 


어떤 내용이 잘못된 것인지 모르겠네요 ㅠㅠ 답변 부탁드리겠습니다. 


아래는 코딩내용 붙이도록 하겠습니다. 


------

 str(alcohol3)

'data.frame': 92 obs. of  28 variables:

 $ birth         : num  1995 1996 1996 1996 1994 ...

 $ sex           : Factor w/ 2 levels "F","M": 2 2 1 2 2 1 1 2 1 2 ...

 $ location      : Factor w/ 3 levels "dorm","parents",..: 3 2 2 2 2 2 3 1 2 2 ...

 $ lifetime_drink: Factor w/ 2 levels "N","Y": 2 2 2 2 2 2 2 2 2 2 ...

 $ 2019drink     : Factor w/ 4 levels "2","3","4","5": 4 2 2 2 1 1 2 2 3 2 ...

 $ alone         : Factor w/ 4 levels "1","2","3","4": 3 2 1 2 1 1 2 1 1 2 ...

 $ amount        : Factor w/ 6 levels "1","2","3","4",..: 5 2 2 4 4 1 3 5 2 4 ...

 $ study_error   : Factor w/ 3 levels "1","2","3": 3 2 1 1 3 1 2 1 1 1 ...

 $ hurt          : Factor w/ 3 levels "1","2","3": 1 1 1 3 1 1 1 3 1 2 ...

 $ hospital      : Factor w/ 3 levels "1","2","3": 1 1 1 3 1 1 1 1 1 3 ...

 $ policeman     : Factor w/ 1 level "1": 1 1 1 1 1 1 1 1 1 1 ...

 $ self_assess   : Factor w/ 5 levels "1","2","3","4",..: 3 3 3 4 4 1 3 4 4 3 ...

 $ man_assess    : Factor w/ 5 levels "1","3","4","5",..: 3 4 4 3 2 3 4 4 4 2 ...

 $ woman_assess  : Factor w/ 6 levels "1","2","3","4",..: 3 5 4 3 3 2 5 4 4 3 ...

 $ club          : Factor w/ 5 levels "1","2","3","4",..: 3 3 3 3 2 2 3 3 3 3 ...

 $ provinces     : Factor w/ 2 levels "1","2": 2 1 1 2 1 1 1 2 1 2 ...

 $ girlfriend    : Factor w/ 3 levels "1","2","3": 1 1 1 3 3 3 3 1 2 1 ...

 $ sports        : Factor w/ 5 levels "1","2","3","4",..: 5 5 2 3 3 5 1 5 4 2 ...

 $ smoking       : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...

 $ grade         : Factor w/ 5 levels "1","2","3","4",..: 4 5 1 1 2 2 1 2 3 1 ...

 $ AUDIT1        : num  16 5 6 13 12 1 9 18 12 12 ...

 $ AUDIT2        : num  18 7 8 15 14 3 11 20 14 14 ...

 $ AUDIT3        : num  20 9 10 17 16 5 13 22 16 16 ...

 $ AUDIT111      : Factor w/ 3 levels "1","2","3": 2 1 2 2 2 1 2 2 3 2 ...

 $ AUDIT12       : Factor w/ 3 levels "1","2","3": 2 1 2 2 2 1 3 3 3 2 ...

 $ AUDIT13       : Factor w/ 3 levels "1","2","3": 3 1 3 2 2 1 3 3 3 2 ...

 $ binge         : Factor w/ 2 levels "1","2": 2 1 2 2 2 1 2 2 2 2 ...

 $ large         : Factor w/ 2 levels "1","2": 2 1 1 1 1 1 1 1 2 1 ...


mytable(binge~.,data=alcohol3) #변수 하나만 넣었을 경우 Error가 나기는 하지만 결과값이 출력은 됩니다. 

Error in data.frame(y = data[[y]], x = data[[x]]) : 
  arguments imply differing number of rows: 92, 0

        Descriptive Statistics by 'binge'       
_________________________________________________ 
                      1             2         p  
                   (N=21)        (N=71)    


mytable(sex+binge~.,data=alcohol3) #변수를 2개 넣었을 경우 결과값이 아예 출력되지 않습니다. 

Error in `[[<-.data.frame`(`*tmp*`, x[j], value = integer(0)) : 

  replacement has 0 rows, data has 92

No. Subject Author Date
773 Survival 패키지를 이용한 KM curve 작성시 오류 문의 [10] 스날푸 2020.04.15
772 지난 번 다운 안되는 문제...공백을 없애도 해결이 안됩니다... [2] file 초록바다 2020.04.15
771 R에서 결측지 제거하는 함수 만들기 [1] 워렌 2020.04.14
770 저도 pptx , word 다운 모두 되지 않습니다. [2] file 초록바다 2020.04.14
769 이럴 땐 어떤 통계분석을 해야하나요? [2] kiho 2020.04.13
768 Error: unused argument [4] FAdavid 2020.04.13
767 Survival curve에 대해 부탁 요청 드려봅니다. [3] secret ckhchoikang 2020.04.12
766 데이터 업로드시 결과값에 제가 입력한 내용과 다른값이 뜹니다. [1] file 남세이짱 2020.04.11
765 Reliability Test (kappa, ICC 등..) [2] 김도 2020.04.10
764 간단한 table 만들기가 되지 않습니다. [3] 남세이짱 2020.04.10
763 Web으로 하는 R meta 서비스는 더 이상 안하는 건가요? [1] 묵사마 2020.04.09
762 survival 에러 [10] ckhchoikang 2020.04.08
» mytable 함수 애러 [5] 사이 2020.04.08
760 shiny output 관련해서 문의드립니다. [5] chrik 2020.04.07
759 ROC 구하기 없어졌나요? [2] 뜨거운감자 2020.04.06
758 바로 아래 작성했던 것 이어서 작성합니다. [5] 비버마다 2020.04.06
757 Error 문구에 대한 질문입니다. [1] 비버마다 2020.04.02
756 prop.test에서 유의수준을 검정하는 방법을 알고 싶습니다. [2] 네잎클로바 2020.04.01
755 Survival curve [1] JJ1518 2020.03.31
754 PPTx 다운에 대해 질문드립니다. [3] 라파엘 2020.03.30