[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
入門(寫過其他程式,只是對語法不熟悉)
[問題敘述]:
[1] "Age" "Blood Pressure" "Specific
Gravity"
[4] "Albumin" "Sugar" "Red Blood
Cellsabnormal"
[7] "Red Blood Cellsnormal" "Pus Cellabnormal" "Pus
Cellnormal"
[10] "Pus Cell clumpsnotpresent" "Pus Cell clumpspresent"
"Bacterianotpresent"
[13] "Bacteriapresent" "Blood Glucose Random" "Blood Urea"
[16] "Serum Creatinine" "Sodium" "Potassium"
[19] "Hemoglobin" "Packed Cell Volume" "White Blood
Cell Count"
[22] "Red Blood Cell Count" "Hypertensionno"
"Hypertensionyes"
[25] "Diabetes Mellitus yes" "Diabetes Mellitusno" "Diabetes
Mellitusyes"
[28] "Coronary Artery Diseaseno" "Coronary Artery Diseaseyes" "Appetitegood"
[31] "Appetitepoor" "Pedal Edemano" "Pedal
Edemayes"
[34] "Anemiano" "Anemiayes" "Classckd"
[37] "Classnotckd"
這是我全部的變數,我想針對"Classckd" 對其他變數做回歸
想請教是否有什麼語法可以比較簡潔的去做回歸
例如data.glm1 <- glm(formula=Classckd~`Pus Cellabnormal`+Age+`Red Blood
Cellsnormal`,data=data.training,family=binomial(link = "logit"))
我想繼續加其他變數進去,但是如果打他的名字感覺會程式碼很長
想說有沒有辦法就只打行的數字就好, 只是我試了幾個都編譯不過
a<-names(data.training)
像我試著把所有名目存到a ,formula=Classckd~ 在這後面加工好像都是無法判讀
求是否有比較好的方法 除了全部貼上外
謝謝
[程式範例]:
[關鍵字]:
Glm