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
1233 선형회귀분석 시 보정변수 사용 관련 질문드립니다. [2] secret 전한울 2023.09.18
1232 그래프 관련 문의드립니다. secret nanak 2023.09.14
1231 영수증 메일로 받을수 있을까요? [1] secret 딸기공주 2023.09.13
1230 mycsv 관련 문의드립니다. [1] 도삼 2023.09.12
1229 matched group 을 대상으로 stratified cox secret saga 2023.09.06
1228 IPTW 시 SMD 계산 관련 여쭙습니다. 장한나 2023.09.04
1227 회귀분석 관련 문의드립니다. [2] secret 전한울 2023.09.04
1226 PSM matching 실행시 disconnected 됩니다... [1] 맹구모션 2023.08.25
1225 메타분석_출간오류분석 관련 질문드립니다. [2] 블루레몬 2023.08.21
1224 plot 문의 드립니다. 1122 2023.08.20
1223 semMediation 설치문의 [2] 마술샘 2023.08.11
1222 로지스틱 회귀분석 문의드립니다. [2] secret JKJ 2023.08.09
1221 지출 문의 드립니다. [1] 블루레몬 2023.08.08
1220 autoReg 실행 중 에러 [1] pkjsdf123 2023.08.08
1219 영수증 처리 [1] secret britnepak 2023.07.28
1218 multipleROC 커브 글을 따라가다 궁금한 것이 생겨서 질문드립니다. [2] file rgppwls 2023.07.20
1217 disconnected from server 오류 [2] secret JKJ 2023.07.13
1216 mytable에서 변수 순서와 ztable적용시 변수가 숫자로 변형 [1] 둥니맨 2023.07.12
1215 box plot 시 X 축 label이 다 나오지 않아 질문드립니다. [2] file 난둥 2023.07.03
1214 안녕하십니까 교수님 PSM 결과에 대해 궁금한 것이 있어 여쭤봅니다 [2] secret 김도훈 2023.06.29