Created
November 9, 2022 16:07
-
-
Save MJacobs1985/9d3e877d8dcb0946876738badd694d13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try<-bpi_combined%>%dplyr::select(Patientnr,time,variable,value)%>% | |
dplyr::filter(variable=="BPI_2_"|variable=="BPI_3_"|variable=="BPI_4_")%>% | |
dplyr::group_by(Patientnr,time)%>%arrange(Patientnr, time);try | |
g1<-ggplot(try, aes(x=as.factor(time),y=as.factor(variable),fill=as.factor(value)))+geom_tile(colour="white",size=0.25, na.rm=TRUE)+ | |
labs(x="",y="")+scale_y_discrete(expand=c(0,0))+ | |
scale_fill_viridis(discrete = TRUE, option="magma", direction = -1 )+ | |
facet_wrap(~Patientnr)+ | |
theme_grey(base_size=10)+marc_discrete | |
Severity_BPI<-try%>%dplyr::summarise(Severity=mean(value));head(Severity_BPI);histogram(Severity_BPI$Severity) | |
g4<-ggplot(Severity_BPI, aes(x=as.factor(time), y=Severity))+geom_boxplot()+theme_classic2()+labs(x="time") | |
g3<-ggplot(Severity_BPI,aes(x=as.factor(time), y=Severity, group=as.factor(Patientnr))) + geom_line() + geom_point() + facet_wrap(~Patientnr) + theme_bw() | |
g2<-ggplot(Severity_BPI,aes(x=as.factor(time), y=as.factor(Patientnr),fill=Severity)) + geom_tile(colour="white",size=0.25, na.rm=TRUE)+ | |
labs(x="",y="")+scale_y_discrete(expand=c(0,0))+scale_fill_viridis(discrete = FALSE, option="rocket", direction = -1 )+ theme_grey(base_size=10)+marc_discrete | |
grid.arrange(g1,g2,g3,g4, ncol=4, top="BPI 'Severity'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment