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
1194 PSM 시 범주형 변수가 총 10가지 일 때 어떻게 돌려야 하는지요 [1] 긍정적인마음가짐 2023.05.06
1193 첫번째 행을 라벨로 사용 버튼 클릭시 에러 문의 [3] file 수담이 2023.05.04
1192 안녕하세요? web-R table 그리고 관련하여 문의드립니다. [4] mkw7654 2023.05.02
1191 메타분석 U3 그래프 관련 문의드립니다 secret 화이팅 2023.05.02
1190 교수님 안녕하세요~~ secret 메시12 2023.04.29
1189 연속형 변수인데 범주형으로 인지됩니다. [2] secret shararaku 2023.04.28
1188 통계마당 [2] secret ejo 2023.04.27
1187 moonBook 오류 관련 재문의드립니다. [1] secret holyhyun 2023.04.24
1186 moonBook 사용시 오류메시지로 문의드립니다. [1] holyhyun 2023.04.24
1185 에러 문의 [2] secret 화이팅 2023.04.19
1184 Cox regression 에 대한 문의입니다. [2] file saga 2023.04.18
1183 PSM 문의 [3] secret starwars 2023.04.13
1182 ggPS, ggPSMSummary function [6] 로렌쵸메디치 2023.04.12
1181 Survival 분석에 대해서 문의 드립니다. 정훈신 2023.04.05
1180 안녕하세요. 분석 툴에 대해 문의드립니다. [1] 스매직맨 2023.04.04
1179 드디어 publish 되었네요. [2] 정지윤 2023.04.04
1178 연구동향분석 시 논문 데이터 정제 관련 [5] vtlbtl 2023.03.31
1177 안녕하세요 교수님 에러 문의드립니다 [2] secret 소소 2023.03.26
1176 코딩값이 여러개인 변수에 대한 전체 p값을 알 수 있는 방법이 궁금합니다 쥬쥬즈주 2023.03.22
1175 PSM 매칭 버튼 보이지 않음. secret swpapa 2023.03.19