Skip to content

Instantly share code, notes, and snippets.

@kennedymwavu
Last active June 18, 2023 23:00
Show Gist options
  • Save kennedymwavu/17ac2a161d1ff031d8bfcf18b8e52aa6 to your computer and use it in GitHub Desktop.
Save kennedymwavu/17ac2a161d1ff031d8bfcf18b8e52aa6 to your computer and use it in GitHub Desktop.
Customize R's startup msg on Rstudio
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")
@vkatti
Copy link

vkatti commented Nov 8, 2022

This is awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment