#install.packages("readxl")
library(readxl)
mydata <- read_xlsx("./Reading xlsx data.xlsx")
head(mydata)
## # A tibble: 6 × 3
## ID Headache Medicine
## <dbl> <dbl> <chr>
## 1 1 59 A
## 2 2 50 A
## 3 3 45 A
## 4 4 55 A
## 5 5 35 A
## 6 6 28 A
Make a descriptve statistics by medicine.
library(psych)
describeBy(mydata$Headache , mydata$Medicine)
##
## 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
plot(mydata$Headache)
Draw a histigram of headaches.
hist(mydata$Headache ,
main = "Distributions of headaches" ,
xlab = "Number of headaches")