r语言执行命令什么键

Python013

r语言执行命令什么键,第1张

1、添加和取消代码注释【Ctrl+Shift+C】

2、入赋值符号【Alt + -】

3、块代码执行【Ctrl+Enter】

4、全部代码执行【Ctrl+Shift+Enter】

5、列模式操作【Alt+Shift+鼠标左键选择】

6、RStudio界面字体方法缩小【Ctrl 和 + -】

R代码常见命令

赋值:<-

查看变量个数和名称:ls()

清除变量:rm(变量名)

等价(赋值):=

关系运算符:==

输出:变量名 或者 print(变量名)

命令代码参考如下:

# 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")