[問題類型]:
程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來)
[軟體熟悉度]:
入門(寫過其他程式,只是對語法不熟悉)
[問題敘述]:
不好意思 原始資料中 有些空白被填上- ? NA這種
但實際上他是遺漏值, 有沒有什麼方式可以把它們取代成空白
讓is.na判斷成是遺漏值, 謝謝!!
[程式範例]:
wdbc=read.table("DM_Assignment_2_Kidney.csv", header=F,sep=",")
wdbc1=wdbc
names(wdbc) <- c("Age","Blood Pressure","Specific
Gravity","Albumin","Sugar","Red Blood Cells","Pus Cell","Pus Cell
clumps","Bacteria","Blood Glucose Random","Blood Urea","Serum
Creatinine","Sodium","Potassium","Hemoglobin","Packed Cell Volume","White
Blood Cell Count","Red Blood Cell Count","Hypertension","Diabetes
Mellitus","Coronary Artery Disease","Appetite","Pedal Edema","Anemia","Class")
for(i in 1:25)(
wdbc1[,i]<-gsub("[?]",NA, wdbc[,i])
)
[關鍵字]:
遺漏值