knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(ggplot2) library(DNAmAgeMini)
[@Horvath2013]
DNAmAge <- as.data.frame(HorvathAgePred(demoBetas)) colnames(DNAmAge) <- "DNAmAge"
df <- demoSampleAnnotation[c("Age"), drop = FALSE] rownames(df) <- demoSampleAnnotation$id df <- merge(df,DNAmAge,by = "row.names") df$AgeAccel <- ageAccel(df$DNAmAge,df$Age) df
ggplot(aes(Age,DNAmAge),data=df) + geom_abline(slope = 1,intercept = 0) + geom_smooth(method = "lm") + geom_point() + coord_equal() + labs( title = "Predicted Vs Chronolgical Age", subtitle = parse(text = paste0( "R^2: ", sprintf( "%.3g", cor(df$Age,df$DNAmAge)**2 ) )) )
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.