violit plot added
This commit is contained in:
commit
b1b21eef1b
1001
german_credit_data.csv
Executable file
1001
german_credit_data.csv
Executable file
File diff suppressed because it is too large
Load Diff
42
projekt.R
Normal file
42
projekt.R
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Projekt 1: Przygotowanie wizualnej analizy danych z wykorzystaniem podstawowej biblioteki graficznej R i/lub biblioteki ggplot2
|
||||||
|
# zaladowanie bibliotek
|
||||||
|
library(Hmisc)
|
||||||
|
library(dplyr)
|
||||||
|
library(ggplot2)
|
||||||
|
library(RColorBrewer)
|
||||||
|
|
||||||
|
# zaladowanie danych
|
||||||
|
german_credit_risk <- read.csv("german_credit_data.csv", header = TRUE)
|
||||||
|
|
||||||
|
# sprawdzenie danych
|
||||||
|
head(german_credit_risk)
|
||||||
|
tail(german_credit_risk)
|
||||||
|
str(german_credit_risk)
|
||||||
|
summary(german_credit_risk)
|
||||||
|
describe(german_credit_risk)
|
||||||
|
|
||||||
|
# zmiana nazwy pierwszej kolumny
|
||||||
|
colnames(german_credit_risk)[1] <- "index"
|
||||||
|
|
||||||
|
min(german_credit_risk$Age)
|
||||||
|
na.omit(german_credit_risk)
|
||||||
|
|
||||||
|
# violin plot
|
||||||
|
ggplot(german_credit_risk, aes(x=Purpose, y=Age, fill=Sex)) +
|
||||||
|
geom_violin(trim=TRUE) +
|
||||||
|
stat_summary(fun = mean, geom="point", shape=25, size=2, position=position_dodge(.9)) +
|
||||||
|
labs(title="Credit purpose by age", x="Purpose", y = "Age") +
|
||||||
|
scale_fill_brewer(palette="Accent") +
|
||||||
|
theme_minimal() +
|
||||||
|
theme(legend.position="bottom")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ggplot(german_credit_risk, aes(x=Purpose, y=Credit.amount, fill=Credit.amount)) +
|
||||||
|
geom_density_ridges(scale = 4) +
|
||||||
|
xlab('Purpose') +
|
||||||
|
ylab('Credit amount') +
|
||||||
|
labs('?') +
|
||||||
|
scale_fill_manual(values = wes_palette("Moonrise3")) +
|
||||||
|
theme_minimal()
|
Loading…
Reference in New Issue
Block a user