## .Rprofile ## 2015-10-05 Yuki Yanai ## 2018-06-09 YY ## 2018-09-18 YY message("Hi Yuki, welcome back to R! Work hard!!!") ## use quartz for graphics on OS X ## Windows users should delete the next line options(device = "quartz") ## suppress annoying significance stars options(show.signif.stars = FALSE) ## use CRAN mirror at ISM options(repos = "https://cran.ism.ac.jp/") ## Eradicate "+" symbols for continuing lines options(continue = " ") ## Enables R and RStudio to handle Japanese characters. ## The following chunk was copied from ## https://gist.github.com/mkmashe/5246026 setHook(packageEvent("grDevices", "onLoad"), function(...){ if(.Platform$OS.type == "windows") grDevices::windowsFonts(sans ="MS Gothic", serif="MS Mincho", mono ="FixedFont") if(capabilities("aqua")) grDevices::quartzFonts( sans =grDevices::quartzFont( c("Hiragino Sans W3", "Hiragino Sans W6", "Hiragino Sans W3", "Hiragino Sans W6")), serif=grDevices::quartzFont( c("Hiragino Mincho ProN W3", "Hiragino Mincho ProN W6", "Hiragino Mincho ProN W3", "Hiragino Mincho ProN W6"))) if(capabilities("X11")) grDevices::X11.options( fonts=c("-kochi-gothic-%s-%s-*-*-%d-*-*-*-*-*-*-*", "-adobe-symbol-medium-r-*-*-%d-*-*-*-*-*-*-*")) grDevices::pdf.options(family="Japan1GothicBBB") grDevices::ps.options(family="Japan1GothicBBB") } ) attach(NULL, name = "JapanEnv") assign("familyset_hook", function() { winfontdevs=c("windows","win.metafile", "png","bmp","jpeg","tiff","RStudioGD") macfontdevs=c("quartz","quartz_off_screen","RStudioGD") devname=strsplit(names(dev.cur()),":")[[1L]][1] if ((.Platform$OS.type == "windows") && (devname %in% winfontdevs)) par(family="sans") if (capabilities("aqua") && devname %in% macfontdevs) par(family="sans") }, pos="JapanEnv") setHook("plot.new", get("familyset_hook", pos="JapanEnv")) setHook("persp", get("familyset_hook", pos="JapanEnv")) # Some functions for convenience # head() and tail() together ht <- function(d, n = 6) { rbind(head(d, n), tail(d, n)) } # Function to run at the end of an R session .Last <- function() { message("See you soon! (", date(), ")\n") }