Describe Your Data:
ggplot(insurance_data, aes(x = CAR_TYPE, y = BLUEBOOK, fill = CAR_TYPE)) +
ggtitle("Distribution of Value of Vechles by Vechles types") +
geom_boxplot(outlier.colour="black",outlier.shape=16,outlier.size=3, notch=F) +
labs(x = "", y = "Value, $", fill = "Car type") +
theme_minimal()
Komentaras
ggplot(insurance_data, aes(x=HOME_VAL, y=INCOME)) +
geom_point() + labs(title = "Relation between Home value, Year Income", x = "Home value, $", y = "Yeary Income, $") +
theme_light()
ggplot(insurance_data, aes(x=HOME_VAL, y=INCOME, color=URBANICITY)) +
geom_point() + geom_smooth(method=lm, se=FALSE, fullrange=TRUE) + labs(title = "Relation between Home value, Year Income and Urbanicity", x = "Home value, $", y = "Yeary Income, $")
## `geom_smooth()` using formula 'y ~ x'
Komentaras
data2 <- as.data.frame(table(insurance_data$URBANICITY))
data2 <- data2 %>%
arrange(desc(Var1)) %>%
mutate(prop = Freq / sum(data2$Freq) *100) %>%
mutate(ypos = cumsum(Freq)- 0.5*Freq )
data2$proc <- paste0(round(data2$prop,1),"%")
ggplot(data2, aes(x="", y=Freq, fill=Var1)) +
geom_bar(stat="identity", width=1, color="white") +
coord_polar("y", start=0) +
theme_void() +
geom_text(aes(y = ypos, label = Freq), color = "white", size=6) +
scale_fill_brewer(palette="Dark2", name = "URBANICITY") +
labs(title = "Percentage of CUSTUMERS who did car accidents form Urban or Rural areas")
data1 <- as.data.frame(table(insurance_data$URBANICITY))
data1 <- data1 %>%
arrange(desc(Var1)) %>%
mutate(prop = Freq / sum(data1$Freq) *100) %>%
mutate(ypos = cumsum(prop)- 0.5*prop )
data1$proc <- paste0(round(data1$prop,1),"%")
ggplot(data1, aes(x="", y=prop, fill=Var1)) +
geom_bar(stat="identity", width=1, color="white") +
coord_polar("y", start=0) +
theme_void() +
geom_text(aes(y = ypos, label = proc), color = "white", size=6) +
scale_fill_brewer(palette="Dark2", name = "URBANICITY") +
labs(title = "Percentage of CUSTUMERS who did car accidents form Urban or Rural areas")
Komentaras
ggplot(insurance_data, aes(x=EDUCATION, y=REPEAT5, fill=EDUCATION)) +
geom_bar(stat="identity") +
labs(title = "Number of drivers by different groups of Education",
x = "Education level", y = "Count") +
theme_light()
ggplot(insurance_data, aes(x=reorder(EDUCATION, -table(EDUCATION)[EDUCATION]), y=REPEAT5, fill=EDUCATION)) +
geom_bar(stat="identity") +
labs(title = "Number of drivers by different groups of Education",
x = "Education level", y = "Count") +
theme_light()
Komentaras