– Import dataset –

#install.packages("readxl")

library(readxl) #to activate the package from the library
## Warning: package 'readxl' was built under R version 4.4.3
mydata <- read_xlsx("./Medicine.xlsx")

View(mydata) 

– Descriptive Statistics –

Compare the degree of headache based on type of medicine:

#install.packages("psych")

library(psych)
## Warning: package 'psych' was built under R version 4.4.3
describeBy(mydata$Headache, group=mydata$Medicine) #remember to specify which dataset are the columns coming from
## 
##  Descriptive statistics by group 
## group: A
##    vars  n mean    sd median trimmed   mad min max range skew kurtosis   se
## X1    1 10 41.5 10.56   39.5      41 11.86  28  59    31  0.3    -1.45 3.34
## ------------------------------------------------------------ 
## group: B
##    vars  n mean    sd median trimmed  mad min max range  skew kurtosis   se
## X1    1 10   37 10.37   40.5   37.75 5.93  18  50    32 -0.66     -1.1 3.28
## ------------------------------------------------------------ 
## group: C
##    vars  n mean   sd median trimmed   mad min max range skew kurtosis  se
## X1    1 10 26.8 8.84     24   26.75 11.12  15  39    24 0.14    -1.84 2.8

First parameter to look at: Mean

In this case, Medicine A is recorded to have the highest mean of headaches while Medicine C is recorded to have the lowest mean of headaches. Hence, Medicine C is the most successful one.