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
1094 안녕하세요 r 코드 중에 도저히 해결이 안나는 문제가 있어서 여기에 문의 드립니다 [1] file 슈퍼맨 2022.06.24
1093 Box plot 그리프 설정에 관해 문의합니다. papahong 2022.06.20
1092 cluster data 의 risk difference 에 대해 여쭙고자 합니다. lagrima 2022.06.19
1091 Pair plot을 할 경우 [1] PipeDragoN 2022.06.13
1090 PSM에서 matching 버튼 위치 문의 통계어려워 2022.06.13
1089 PSM (4그룹) 관련 문의드립니다. emksh77 2022.06.08
1088 정회원후원하였습니다. [1] secret rosemary 2022.06.08
1087 PSM 문의 [2] secret sfumatoi 2022.06.07
1086 multipleROC 패키지에서 multivariable의 cutoff 구하기 file 찬쓰 2022.06.07
1085 survival analysis관련 문의 드립니다 [1] cebukim 2022.06.04
1084 autoReg 설치 관련 오류 [5] 닥터강 2022.05.24
1083 survival tree (RPA) 분석 관련 문의 드립니다. [2] 곰곰11 2022.05.23
1082 통계 질문입니다. [1] file 봄봄봄 2022.05.23
1081 데이터 불러오기 문제 [3] strat 2022.04.25
1080 r프로그래밍 문자는 factor로 읽을 수 없나요? [1] file 채채채추ㅐㅊ채야채 2022.04.21
1079 R 코드와 관련하여 문의 드려도 될까요..? [5] file 꾸이뭉 2022.04.19
1078 R 업데이트 후 mytable 함수 에러가 있습니다. [1] 카이토르 2022.04.18
1077 Survival curve 에서 cumulative incidence % 로 표현 가능할까요 [1] nyknicks 2022.04.16
1076 multiple logistic regression test에서 설명변수 선택에 대해 여쭙습니다. [2] file kms9057 2022.04.16
1075 PSM 문의 드립니다 [1] caesar 2022.04.07