Last active
June 18, 2023 23:00
-
-
Save kennedymwavu/17ac2a161d1ff031d8bfcf18b8e52aa6 to your computer and use it in GitHub Desktop.
Customize R's startup msg on Rstudio
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
setHook("rstudio.sessionInit", function(newSession) { | |
cat('\f') | |
hour <- format(Sys.time(), format = '%H') |> as.numeric() |> as.character() | |
morning <- 0:11 | |
afternoon <- 12:16 | |
evening <- c(17:23) | |
day_hrs <- rep( | |
x = c('Morning', 'Afternoon', 'Evening'), | |
times = c(length(morning), length(afternoon), length(evening)) | |
) | |
names(day_hrs) <- as.character(0:23) | |
cli::cli_rule(center = '::') | |
cli::cli_text( | |
cli::col_magenta(paste0('Good ', day_hrs[hour], ', Mwavu.')) | |
) | |
cli::cli_blockquote( | |
quote = paste0( | |
'R is not a language driven by the purity of its philosophy; ', | |
'R is a language designed to get shit done.' | |
), | |
citation = '@hadleywickham, rstudioconf2022.' | |
) | |
cli::cli_rule(center = '::') | |
}, action = "append") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is awesome!