R တွင်ကော်လံများ၏စံသွေဖည်တွက်ချက်နည်း
R ရှိ ကော်လံများ၏ စံသွေဖည်မှုကို တွက်ချက်ရန် အောက်ပါ အခြေခံ အထားအသိုကို အသုံးပြုနိုင်သည်။
#calculate standard deviation of one column sd(df$col1) #calculate standard deviation of all columns sapply(df, sd) #calculate standard deviation of specific columns sapply(df[c(' col1 ', ' col2 ', ' col5 ')], sd)
အောက်ပါဥပမာများသည် အောက်ပါဒေတာဘောင်ဖြင့် ဤ syntax ကို လက်တွေ့တွင် မည်သို့အသုံးပြုရမည်ကို ပြသသည်-
#create data frame df <- data. frame (team=c('A', 'B', 'C', 'D', 'E'), points=c(99, 91, 86, 88, 95), assists=c(33, 28, 31, 39, 34), rebounds=c(30, 28, 24, 24, 28)) #view data frame df team points assists rebounds 1 A 99 33 30 2 B 91 28 28 3 C 86 31 24 4 D 88 39 24 5 E 95 34 28
ဥပမာ 1- ကော်လံတစ်ခု၏ စံသွေဖည်မှု
အောက်ပါကုဒ်သည် ဒေတာဘောင်ရှိ ကော်လံတစ်ခု၏ စံသွေဖည်မှုကို တွက်ချက်နည်းကို ပြသသည်-
#calculate standard deviation of 'points' column
sd(df$points)
[1] 5.263079
“အမှတ်များ” ကော်လံရှိ တန်ဖိုးများ၏ စံသွေဖည်မှုသည် 5.263079 ဖြစ်သည်။
ဥပမာ 2- ကော်လံအားလုံး၏ စံသွေဖည်မှု
အောက်ပါကုဒ်သည် ဒေတာဘောင်ရှိ ကော်လံတစ်ခုစီ၏ စံသွေဖည်မှုကို တွက်ချက်နည်းကို ပြသသည်-
#calculate standard deviation of all columns in data frame
sapply(df, sd)
team points assists rebounds
NA 5.263079 4.062019 2.683282
Warning message:
In var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm = na.rm):
NAs introduced by coercion
“ အဖွဲ့” ကော်လံသည် အက္ခရာပြောင်းလဲမှုဖြစ်နိုင်သောကြောင့် R သည် NA ကိုပြန်၍ သတိပေးချက်ပေးသည်။
သို့သော်၊ ၎င်းသည် အခြားသော ဂဏန်းကော်လံသုံးခု၏ စံသွေဖည်မှုကို အောင်မြင်စွာ တွက်ချက်သည်။
ဥပမာ 3- တိကျသောကော်လံများ၏ Standard Deviation
အောက်ပါကုဒ်သည် ဒေတာဘောင်ရှိ သီးခြားကော်လံများ၏ စံသွေဖည်မှုကို တွက်ချက်နည်းကို ပြသသည်-
#calculate standard deviation of 'points' and 'rebounds' columns
sapply(df[c(' points ', ' rebounds ')], sd)
rebound points
5.263079 2.683282
ကော်လံများကိုရွေးချယ်ရန် ကော်လံအညွှန်းတန်ဖိုးများကိုလည်း အသုံးပြုနိုင်ကြောင်း သတိပြုပါ။
#calculate standard deviation of 'points' and 'rebounds' columns
sapply(df[c(2, 4)], sd)
rebound points
5.263079 2.683282
ထပ်လောင်းအရင်းအမြစ်များ
အောက်ဖော်ပြပါ သင်ခန်းစာများသည် R တွင် အခြားဘုံလုပ်ဆောင်ချက်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-
R တွင် အတန်းများ၏ စံသွေဖည်မှုကို တွက်ချက်နည်း
R တွင် ကော်လံအများအပြား၏ ပျမ်းမျှအား တွက်ချက်နည်း
R တွင် ကော်လံများစွာတွင် အမြင့်ဆုံးတန်ဖိုးကို မည်သို့ရှာမည်နည်း။
R တွင် သီးခြားကော်လံများကို မည်သို့ရွေးချယ်ရမည်နည်း။