์ƒˆ์†Œ์‹

์ธ๊ธฐ ๊ฒ€์ƒ‰์–ด

๐Ÿ“‘ R

[R] data set

  • -
๋ฐ˜์‘ํ˜•
1๋ฒˆ ๋ฌธ์ œ

CSV ํŒŒ์ผ์ด ์žˆ๋Š” ๋ฐ”ํƒ•ํ™”๋ฉด์œผ๋กœ ๋””๋ ‰ํ† ๋ฆฌ ์ด๋™

setwd("C:/Users/user/Desktop")

CSV ํŒŒ์ผ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ / ์—๋Ÿฌ์˜ ์ด์œ  = ํŒŒ์ผ์„ ํ•œ๊ธ€ ์ธ์ฝ”๋”ฉ ํ•ด์ฃผ์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ

fileEncoding = "euc-kr" ์˜ต์…˜์„ ๋„ฃ์–ด์ฃผ๋ฉด๋œ๋‹ค.

boxplot_data <- read.csv("boxplot_data.csv")

Error in make.names(col.names, unique = TRUE) : 
  invalid multibyte string at '<b3>๋ผฑ'
  

boxplot_data <- read.csv("boxplot_data.csv",fileEncoding = "euc-kr")

 subset ํ•จ์ˆ˜ ์ด์šฉํ•ด ์Šน์ฐจ ์ธ์› ์ถ”์ถœ 

up1 <- subset(boxplot_data, subset = group == '์Šน์ฐจ')

ํ•ด๋‹น ๋ฐ์ดํ„ฐ์—์„œ y์ถ• ์ด ์Šน๊ฐ์ˆ˜ , x์ถ• ์—ญ ๋ช… boxplot

boxplot(์ด์Šน๊ฐ์ˆ˜~์—ญ๋ช…, data = up1)


์ด์ƒ์น˜ 20 ์„ค์ • , outbg="black" ์„ค์ •

boxplot(์ด์Šน๊ฐ์ˆ˜~์—ญ๋ช…,data = up1,outpch= 20, outbg="black")


2๋ฒˆ ๋ฌธ์ œ

์Šน์ฐจ ๋ฐ ํ•˜์ฐจ ์ธ์› ์ถ”์ถœ

upup <- subset(boxplot_data, subset = group == '์Šน์ฐจ')
downdown <- subset(boxplot_data, subset = group == 'ํ•˜์ฐจ')

boxplot ํ•จ์ˆ˜์˜ ์˜ต์…˜์—์„œ boxwex=0.2 ํ†ตํ•ด ๋ฐ•์Šค์˜ ๋„“์ด, at=1:5๋ฅผ ํ†ตํ•œ ์ž‘์„ฑ ์œ„์น˜ ์ง€์ •
์ด์ƒ์น˜(outlier)์˜ ๊ฐ’ outpch=20๊ณผ outbg="black" ์˜ต์…˜ ์‚ฌ์šฉ
๋‘๋ฒˆ์งธ boxplot ํ•จ์ˆ˜ ๋ฐ์ดํ„ฐ ์ถ”์ถœ ํ›„ add=T ์˜ต์…˜ ์ถ”๊ฐ€ , boxwex=0.2๋ฅผ ํ†ตํ•ด ๋ฐ•์Šค ๋„“์ด , at=1:5+0.2๋ฅผ ํ†ตํ•œ ์ž‘์„ฑ ์œ„์น˜ ์ง€์ •

boxplot(์ด์Šน๊ฐ์ˆ˜~์—ญ๋ช…,data = upup,outpch= 20, outbg="black", boxwex=0.25, at=1:5)
boxplot(์ด์Šน๊ฐ์ˆ˜~์—ญ๋ช…,data = downdown,outpch= 20, outbg="black", add=T, boxwex=0.2, at=1:5+0.2)

๋ฐ˜์‘ํ˜•
Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.