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语言编程
182
9
R
中直接输入上述代码,将会出错。大括号的开口部分
{
,不应另起一行,随
后紧跟分行符。大括号的封闭部分应独立成行(除非紧跟着 elseelse 应该
紧跟在其后)。大括号中的代码应该缩进(并且
RStudio
执行该规则),下
面代码演示该规则:
#
好的格式
if
x < 5
{
x
} else {
y
}
练习
1.
基于你写过的有代表性的
R
脚本,比较你的风格和
RStudio
的风格(见本
章前面“编码风格”一节)。
相似的地方
?
差异的地方?你保持一致吗?
写下这些问题并考虑基于此改善你的编码风格。
版本控制
当一个项目变得庞大、复杂或者关键任务,跟踪项目的进展是很重要的。与
Dropbox
备份你的文件方式一样,版本控制系统也备份了你的代码。二者的
差异是版本控制系统的永远备份你的代码。
我们推荐的版本控制系统是
Git
,一个由
Linux Torvalds
创造的命令行程序,
Linux Torvalds
也发明了
Linux
2
。如果你不熟悉
shell
(例如
UNIX
命令行),
使用
Git
管理你的项目最简单方法使用
RStudio
窗口右上角的
Git
选项卡(见
9-1
)。该图显示了一些被更改的文件(
M
标记)以及一些新文件(
?
标记)。
勾选复选框将提交对应的文件。
提交
提交是版本控制的基本命令。保持你的提交原子化:每次提交仅做一件事。
2
我们推荐
Linux.com
的“
10 Years of Git: An Interview with Git Creator Linus
Torvalds
”,该文章有更多详细信息。 ...
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