#' Set root
#'
#' Automatically change root directory based on OS
#' @param Takes root directory from Sys.info
#' @keywords directory
#' @export
#' @examples
#' Sroot()
Sroot <- function()
{
if (.Platform$OS.type == "windows") {
root <- paste("C:\\Users\\", Sys.info()["user"], sep= "")
} else if (Sys.info()["sysname"] == "Darwin") {
root <- paste("/Users/", Sys.info()["user"], sep= "")
} else if (.Platform$OS.type == "unix") {
root <- paste("/usr/", Sys.info()["user"], sep= "")
} else {
stop("Unknown OS")
}
setwd(root)
cat("Root directory = ", getwd() )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.