red_bulb <-
c
(38.9, 61.2, 73.3, 21.8, 63.4, 64.6, 48.4, 48.8)
orange_bulb <-
c
(47.8, 60, 63.4, 76, 89.4, 67.3, 61.3, 62.4)
BULB_PRICE =
c
(red_bulb, orange_bulb)
BULB_TYPE =
rep
(
c
(
"red"
,
"orange"
), each = 8)
DATASET <-
data.frame
(BULB_TYPE, BULB_PRICE, stringsAsFactors =
TRUE
)
DATASET
install.packages
(
"dplyr"
)
install.packages
(
"ggpubr"
)
library
(dplyr)
group_by
(DATASET,BULB_TYPE) %>%
summarise
(
count =
n
(),
median =
median
(BULB_PRICE, na.rm =
TRUE
),
IQR =
IQR
(BULB_PRICE, na.rm =
TRUE
))
library
(
"ggpubr"
)
ggboxplot
(DATASET, x =
"BULB_TYPE"
, y =
"BULB_PRICE"
,
color =
"BULB_TYPE"
, palette =
c
(
"#FFA500"
,
"#FF0000"
),
ylab =
"BULB_PRICES"
, xlab =
"BULB_TYPES"
)
res <-
wilcox.test
(BULB_PRICE~ BULB_TYPE,
data = DATASET,
exact =
FALSE
)
res