-
Notifications
You must be signed in to change notification settings - Fork 138
Description
"r.rterm.windows": "D:/Python/Scripts/radian.exe",
"r.plot.useHttpgd": true,
"r.rpath.windows": "D:/R/base/bin/R.exe",
"r.sessionWatcher": true,
"r.bracketedPaste": true,
加载内置数据集
data(mtcars)
绘制散点图,显示马力和每加仑英里数的关系
正确写法:括号要包住所有内容
plot(
x = mtcars$hp,
y = mtcars$mpg,
col = "blue",
pch = 19,
main = "必杀技测试成功!"
)
添加红线
abline(lm(mtcars$mpg ~ mtcars$hp), col = "red")
添加线性回归线
abline(lm(mtcars$mpg ~ mtcars$hp), col = "red")
使用ctrl+enter运行这个代码时候
r$> plot()
Error in plot.default() : argument "x" is missing, with no default
r$> x = mtcars$hp,
Error: unexpected ',' in " x = mtcars$hp,"
r$> y = mtcars$mpg,
Error: unexpected ',' in " y = mtcars$mpg,"
r$> col = "blue",
Error: unexpected ',' in " col = "blue","
r$> pch = 19,
Error: unexpected ',' in " pch = 19,"
r$> main = "必杀技测试成功!"
r$> )
Error: unexpected ')' in ")"
r$>
r$> # 添加红线
r$> abline(lm(mtcars$mpg ~ mtcars$hp), col = "red")
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet
r$>
r$> # 添加线性回归线
r$> abline(lm(mtcars$mpg ~ mtcars$hp), col = "red")
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
plot.new has not been called yet