Last active
March 5, 2024 04:34
-
-
Save vjvelascorios/e3677e2be3f84711552a8c2c074525ff to your computer and use it in GitHub Desktop.
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
niveles <- function(x) { | |
resultado <- levels(as.factor(x)) | |
return(resultado) | |
} | |
if (interactive() && requireNamespace("rsthemes", quietly = TRUE)) { | |
# Set preferred themes if not handled elsewhere.. | |
rsthemes::set_theme_light("base16 Summerfruit Light {rsthemes}") # light theme | |
rsthemes::set_theme_dark("base16 Brewer {rsthemes}") # "base16 Brewer {rsthemes}" "base16 PhD {rsthemes}" | |
# Whenever the R session restarts inside RStudio... | |
setHook("rstudio.sessionInit", function(isNewSession) { | |
# Automatically choose the correct theme based on time of day | |
rsthemes::use_theme_auto(dark_start = "18:30", dark_end = "8:00") | |
}, action = "append") | |
} | |
set_wdir <- function(directorio_windows, directorio_linux, directorio_otro = tempdir()) { | |
# Comprobar el sistema operativo | |
if (Sys.info()["sysname"] == "Windows") { | |
directorio <- directorio_windows | |
} else if (Sys.info()["sysname"] == "Linux") { | |
directorio <- directorio_linux | |
} else { | |
directorio <- directorio_otro | |
} | |
# Establecer el directorio de trabajo | |
setwd(directorio) | |
# Imprimir el directorio actual para verificar | |
print(getwd()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment