Skip to Content
高效R语言编程
book

高效R语言编程

by Colin Gillespie, Robin Lovelace
August 2018
Intermediate to advanced
227 pages
4h 16m
Chinese
China Electric Power Press Ltd.
Content preview from 高效R语言编程
高效安装
35
.Rprofile
文件例程
2-1
让你走入
.Rprofile
并亲身体会它。请注意,这只是普普通通的
R
脚本
文件起了一个特殊名字而已。最好实践的方法是在你当前工作路径下创建同
样脚本,并保存成
.Rprofile
,而后重启
R
会话观察发生什么变化。在
RStudio
中可通过单击“
Session
”→“
Restart R
”或者快捷键
Ctrl-Shift-F10
重启
R
会话。
2-1 .Rprofile
文件内容
#
有趣的欢迎词
message("Hi Robin, welcome to R")
#
自定义每行命令的前置
R
提示符
#
(使用
""
做空提示符)
options(prompt = "R4geo> ")
我们先快速说明下每行代码的含义。第一行在每次新的
R
对话启动时在控
制台输出一条欢迎词。第二行修改了控制台提示符(默认的设置为 >)。值
得注意的是,简单地将多行命令添加到
.Rprofile
文件就可以设置更多的特
性。
.Rprofile
(与
.Renviron
)的一个重要特性是每个
R
对话中每行代码仅运
行一次。这意味着
.Rprofile
内设置的选项在对话中可轻易地改变。例如,在
对话中执行下面命令将恢复缺省提示符:
options(prompt = "> ")
后续将更详尽地描述各种各样的
.Rprofile
文件的潜在的有用的选项。更多有
关启动设置的建议参见 help(
"
Startup
"
) 命令中的例子以及
statmethods.net
http://www.statmethods.net/interface/customizing.html ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学之编程技术:使用R进行数据清理、分析与可视化

数据科学之编程技术:使用R进行数据清理、分析与可视化

迈克尔 弗里曼, 乔尔 罗斯
R数据科学

R数据科学

Hadley Wickham, Garrett Grolemund

Publisher Resources

ISBN: 9787519820855