R语言常用命令集合
help.start()//打开帮助文档
q()//推出函数
ls()//返回处于现在名空间的对象名称
rm()//清楚对象;rm(list=ls())清除所有内存数据
gc()//垃圾回收数据
sqrt(x)//标准差
rnorm()函数
布朗运动
plot(x, y = NULL, type = "p", xlim = NULL, ylim = NULL,
log = "", main = NULL, sub = NULL, xlab = NULL, ylab = NULL,
ann = par("ann"), axes = TRUE, frame.plot = axes,
panel.first = NULL, panel.last = NULL, asp = NA, ...)
plot 支持R 模块有:functions,data.frames,density,factor,table等常用结构。
- #设置所有可用的参数
- plot(x = mtcars$wt,
- y = mtcars$mpg,
- type="o",#线型
- main="标题",
- sub="子标题",
- xlab="x轴",
- ylab="y轴",
- asp=0.1)#y/x的比例,y轴数值长度与x轴数值长度的比值
点"p" for points,
线"l" for lines,
点线"b" for both,
点线图去掉点"c" for the lines part alone of "b",
覆盖式的电线"o" for both ‘overplotted’,
类似直方图"h" for ‘histogram’ like (or ‘high-density’) vertical lines,
楼梯状"s" for stair steps,
楼梯状"S" for other steps, see ‘Details’ below,
不显示"n" for no plotting.
system.file("data", "morley.tab" , package="datasets")#从对象 morley 中得到实验数据的文件路径
file.show(filepath)#查看文件内容
read.table(filepath)#以数据框的形式读取数据