# An R function to clear the screen on RGui:
cls <- function() {
if (.Platform$GUI[1] != "Rgui")
return(invisible(FALSE))
if (!require(rcom, quietly = TRUE)) # Not shown any way!
stop("Package rcom is required for 'cls()'")
wsh <- comCreateObject("Wscript.Shell")
if (is.null(wsh)) {
return(invisible(FALSE))
} else {
comInvoke(wsh, "SendKeys", "\014")
return(invisible(TRUE))
}
}
#cls() # test
# If you want to make sure that it worked (well, not 100% sure, but...)
res <- cls()
if (res) cat("Console should be cleared now!\n")
正确说法有2、通过rstudio工具设置默认的工作目录。
3、R语言的赋值符号 4、查看和删除对象。
5、历史记录、清空屏幕、保存工作空间。
工作目录(present working directory)是文件系统当前所在的目录,如果命令没有额外指定路径,则默认为当前工作目录。比如ls命令,如果没有指定目录,就会显示出当前工作目录的文件。
在Linux中,路径可以用绝对路径和相对路径表示,相对路径就是相对于当前工作目录。当前工作目录可以使用pwd命令获取。