5.获取帮助
?函数名(R的帮助文档)Google/Stackoverflow如何问问题 #操作系统、版本、哪一步产生的错误、预期是什么、得到的结果是什么、其他有用信息 Win7 R 3.2.0 lm() "seg fault on large data frame"补充
www.kaggle.com提供大数据竞赛的平台rpubs.com类似于github的代码发布平台It’s a good idea to keep your projects in separate directories.I typically start an R session by issuing the setwd() command whit the appropriate path to a project,followed by the load() command without options.This lets me start up where I left off in my last session and keeps the data and settings separate between projects.On Windows and Mac OS X platform,it’s even easier.Just navigate to the project directory and double-click on the saved image file(.RData). Doing so will start R,load the saved workspace,and set the current working directory to this location.——《R in Action》
文本重定向
>sink() #不带参数,默认是terminal输出 >sink(filename="xx.txt",append=TRUE,split=TRUE) >#append表明以追加方式,split表明输出同时到文件和terminal >#小例子 > sink("tp.txt") #writ all output to file tp.txt > for (i in 1:5) print(i); > sink() #stop sinking, =sink(NULL) In the tp.txt, the content is: [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 > sink.number() [1] 0 > for (i in 1:5) print(i) #no sinking, then print to screen [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 > unlink("tp.txt") #delete the file tp.txt图形输出
>#sink()不对图形起作用 >#保存一个图片的例子 >png("myplot.png") >x<-(1,2,3) >hist(x) >dev.off()还有很多图形输出函数,需要时请查找相关资料