R တွင် ဘေးချင်းကပ် အကွက်ကွက်များ ဖန်တီးနည်း (ဥပမာများနှင့်အတူ)


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

ဤသင်ခန်းစာတွင် အောက်ပါဒေတာဘောင်ကို အသုံးပြု၍ R နှင့် ggplot2 တွင် ဘေးချင်းကပ်လျက် boxplot များဖန်တီးနည်းကို ရှင်းပြထားသည်။

 #create data frame
df <- data. frame (team=rep(c(' A ', ' B ', ' C '), each= 8 ),
                 points=c(5, 5, 6, 6, 8, 9, 13, 15,
                          11, 11, 12, 14, 15, 19, 22, 24,
                          19, 23, 23, 23, 24, 26, 29, 33))

#view first 10 rows
head(df, 10)

   team points
1 to 5
2 to 5
3 to 6
4 to 6
5 to 8
6 to 9
7 to 13
8 to 15
9 B 11
10 B 11

ဘေးချင်းယှဉ် R-အခြေခံသေတ္တာကွက်များ

အောက်ဖော်ပြပါ ကုဒ်သည် အခြေခံ R တွင် ဘေးချင်းကပ် ကွက်ကွက်များ ဖန်တီးနည်းကို ပြသသည် ။

 #create vertical side-by-side boxplots
boxplot(df$points ~ df$team,
        col=' steelblue ',
        main=' Points by Team ',
        xlab=' Team ',
        ylab=' Points ') 

ဘေးချင်းယှဉ် R-အခြေခံသေတ္တာကွက်များ

အလျားလိုက်=TRUE အငြင်းအခုံကို ဒေါင်လိုက်မဟုတ်ဘဲ အလျားလိုက် အလျားလိုက်ဖော်ပြရန် ကျွန်ုပ်တို့အသုံးပြုနိုင်သည်-

 #create horizontal side-by-side boxplots
boxplot(df$points ~ df$team,
        col=' steelblue ',
        main=' Points by Team ',
        xlab=' Points ',
        ylab=' Team ',
        horizontal= TRUE ) 

ggplot2 ရှိ ဘေးချင်းကပ် ကွက်ကွက်များ

အောက်ပါကုဒ်သည် ggplot2 တွင် ဘေးချင်းကပ်လျက် ဒေါင်လိုက်အကွက်ကွက်များ ဖန်တီးနည်းကို ပြသသည်-

 library (ggplot2)

#create vertical side-by-side boxplots
ggplot(df, aes(x=team, y=points, fill=team)) +
  geom_boxplot() +
  ggtitle(' Points by Team ') 

ဒေါင်လိုက်မဟုတ်ဘဲ အကွက်ကွက်များကို အလျားလိုက်ပြသရန် coord_flip() အငြင်းအခုံကို အသုံးပြုနိုင်ပါသည်။

 library (ggplot2)

#create horizontal side-by-side boxplots
ggplot(df, aes(x=team, y=points, fill=team)) +
  geom_boxplot() +
  coordinate_flip() +
  ggtitle(' Points by Team ') 

ထပ်လောင်းအရင်းအမြစ်များ

R ဖြင့် Bar Chart ဖန်တီးနည်း
R တွင် စာကြောင်းများစွာဆွဲနည်း
R တွင် လူဦးရေပိရမစ်ကို ဖန်တီးနည်း

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

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