我正在尝试使用ggplot绘制血压与结果的直方图,但R中给出的图未遵循数据文件中提供的数据。这是数据文件的链接:https://www.kaggle.com/kandij/diabetes-dataset
dataset=read.csv(file.choose(),header=T)
attach(dataset)
View(dataset)
str(dataset)
summary(dataset)
Bloodpressure_Freq <- frequency(dataset$BloodPressure)
Positive_or_Negative <- as.factor(dataset$Outcome)
ggplot(data = dataset,
aes(x = BloodPressure, Bloodpressure_Freq, fill =Positive_or_Negative)) +
geom_col()+
labs(title = "Histogram for Age", x = "Age", y = "Count") +
theme(plot.title = element_text(hjust = 0.5))