R တွင် variable နှစ်ခု၏ histogram တစ်ခုဖန်တီးနည်း


histogram သည် ပေးထားသော variable တစ်ခုအတွက် တန်ဖိုးများ ဖြန့်ဖြူးမှုကို မြင်သာစေရန် အသုံးဝင်သော နည်းလမ်းတစ်ခုဖြစ်သည်။

R တွင် variable တစ်ခုအတွက် histogram တစ်ခုကို ဖန်တီးရန်၊ သင်သည် hist() လုပ်ဆောင်ချက်ကို အသုံးပြုနိုင်သည်။ R တွင် variable နှစ်ခုအတွက် histogram တစ်ခုကို ဖန်တီးရန်၊ သင်သည် အောက်ပါ syntax ကို အသုံးပြုနိုင်ပါသည်။

 hist(variable1, col=' red ')
hist(variable2, col=' blue ', add= TRUE )

အောက်ဖော်ပြပါ ဥပမာသည် ဤ syntax ကို လက်တွေ့တွင် မည်သို့အသုံးပြုရမည်ကို ပြသထားသည်။

ဥပမာ- R တွင် Variable နှစ်ခု၏ Histogram တစ်ခုကို ဖန်တီးပါ။

အောက်ပါကုဒ်သည် R တွင် variable နှစ်ခု၏ ဟီစတိုဂရမ်တစ်ခုကို ဖန်တီးနည်းကို ပြသသည်-

 #make this example reproducible
set. seeds (1)

#define data
x1 = rnorm(1000, mean=0.6, sd=0.1)
x2 = rnorm(1000, mean=0.4, sd=0.1)

#plot two histograms in same graph
hist(x1, col=' red ')
hist(x2, col=' blue ', add= TRUE )

ဟီစတိုဂရမ်တန်ဖိုးများ ထပ်နေသောကြောင့်၊ ပွင့်လင်းမြင်သာမှု တိုးမြင့်လာခြင်းဖြင့် rgb() အရောင်များကို အသုံးပြုရန် အကြံဉာဏ်ကောင်း ဖြစ်ပါသည်။

 #make this example reproducible
set. seeds (1)

#define data
x1 = rnorm(1000, mean=0.6, sd=0.1)
x2 = rnorm(1000, mean=0.4, sd=0.1)

#plot two histograms in same graph
hist(x1, col=rgb(0,0,1,0.2), xlim=c(0, 1),
     xlab=' Values ', ylab=' Frequency ', main=' Histogram for two variables ')
hist(x2, col=rgb(1,0,0,0.2), add= TRUE ) 

R တွင် variable နှစ်ခုအတွက် Histogram

ဟီစတိုဂရမ်များကို အဓိပ္ပာယ်ဖွင့်ဆိုရန် ပိုမိုလွယ်ကူစေရန် ဒဏ္ဍာရီတစ်ခုကိုလည်း ထည့်နိုင်သည်။

 #make this example reproducible
set. seeds (1)

#define data
x1 = rnorm(1000, mean=0.6, sd=0.1)
x2 = rnorm(1000, mean=0.4, sd=0.1)

#plot two histograms in same graph
hist(x1, col=rgb(0,0,1,0.2), xlim=c(0, 1),
     xlab=' Values ', ylab=' Frequency ', main=' Histogram for two variables ')
hist(x2, col=rgb(1,0,0,0.2), add= TRUE )

#add legend
legend(' topright ', c(' Variable 1 ', ' Variable 2 '),
       fill=c(rgb(0,0,1,0.2), rgb(1,0,0,0.2)))

ဥပမာ R တွင် ကိန်းရှင်နှစ်ခု၏ Histogram


နောက်ထပ် R သင်ခန်းစာများကို ဤစာမျက်နှာတွင် သင်တွေ့နိုင်ပါသည်။

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်