Last active
October 20, 2023 18:38
-
-
Save WillForan/e97865204fad4ac43791c9ab7f6d6724 to your computer and use it in GitHub Desktop.
using R and LNCDR for a visit age waterfall plot
This file contains 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
# get needed libraries | |
install.packages(c('remotes','readxl', 'ggplot2')) | |
remotes::install_github('LabNeuroCogDevel/LNCDR') | |
library(LNCDR) | |
# read in data | |
# expects a row per visit with a column for id shared across visit and age at visit | |
# TODO: replace my_data.xlsx with actual excel document path/name | |
mydata <- readxl::read_xlsx("my_data.xlsx") | |
# rename columns to expected: "id" and "age" | |
# TODO: replace my id column and my age column with what's in excel sheet | |
data_for_waterfall <- mydata %>% select(id=`my id column`,age=`my age column`) | |
# plot | |
# TODO: see https://github.com/LabNeuroCogDevel/LNCDR#waterfall_plot for color and saving | |
waterfall_plot(data_for_waterfall) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment