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
1153 webrPSM 설치 문제 [1] hawk1227 2023.01.03
1152 정회원용서버 ExploPlots 오류 [1] 버블 2023.01.03
1151 생존분석에서 세군이상 시 사후 검정이 가능할지 여쭙습니다 [1] 정망고 2023.01.03
1150 gaze에서 show.stats Arguments가 작동하지 않습니다. [1] 김찬식 2022.12.31
1149 서버 연결이 자꾸 끊깁니다. [1] secret wave 2022.12.30
1148 PSM, full matching, cox proportional hazard model [4] file 주니 2022.12.28
1147 비밀번호 찾기 오류. [2] ezra006 2022.12.24
1146 그래프 만들던 중 오류 질문드립니다.. [1] file 헝힝헝 2022.12.14
1145 multipleROC 패키지 질문 [2] 강우성 2022.12.14
1144 웹에서 하는 R통계 (무료버전) 업로드 가능한 파일 용량이 궁금합니다. [2] 성열 2022.12.10
1143 데이터프레임 자료를 ggplot2를 이용해 꺾은선그래프 그리는 방법 [1] 다다다다빈 2022.12.06
1142 서버에서 table 만들기 에러 [1] 버블 2022.12.04
1141 mytable 문의드립니다. [1] file seyi0918 2022.11.30
1140 교수님 안녕하세요 moonbook 패키지 mycsv 오류가 나서 문의드립니다. [1] holyhyun 2022.11.15
1139 autoReg(fit, uni=TRUE)시, multivariable에 들어갈 변수들을 manual로 선택할 수 있을까요? [6] 김찬식 2022.11.14
1138 processR 패키지에서 Measurment model 정의가 가능한지요. chrik 2022.11.13
1137 Incidence rate per person-years 및 rate ratio에 대한 95% CI 산출 방법 문의 [1] file 꾸이뭉 2022.11.11
1136 서열로짓 시 평균한계효과 요다 2022.10.30
1135 서버문제로 ppt 다운로드가 안된다고 뜹니다. [5] liverim 2022.10.26
1134 메타분석 문의드립니다. file neurojang 2022.10.23