Skip to Content
R 语言经典实例(原书第 2 版)
book

R 语言经典实例(原书第 2 版)

by J.D. Long, Paul Teetor
June 2020
Beginner to intermediate
522 pages
9h 6m
Chinese
China Machine Press
Content preview from R 语言经典实例(原书第 2 版)
384
12
12.20.3 讨论
代码段只是一种特殊格式的 R 注释,因为它们以 # 符号开头。如果你使用除 RStudio
外的任何编辑器打开代码,它们将被视为代码注释。但是,RStudio 将这些特殊格式的
码注释视为节标题,并在编辑器的右侧面板中创建了一个有用的代码大纲。
第一次使用代码段时,可能需要单击 Source 按钮右侧的外线图标以显示
大纲。
如果你正在编写 R Markdown 而不是 *.R 脚本,则 Markdown 的标题和子标题将显示在
大纲窗格中,从而使你的文档导航变得更加容易。
12.20.4 另请参阅
有关在 R Markdown 文档中使用节标题,请参阅 16.4 节。
12.21 本地并行运行 R 代码
12.21.1 问题
代码需要一段时间才能运行,需要通过使用本地计算机上 CPU 的多个内核(core)来加
快速度。
12.21.2 解决方案
启动和运行多核的最简单的解决方案是使用 furrr 添加包,该添加包又使用 future
添加包,它的函数类似于 purrr 包的函数,不过函数是以并行方式运行的。
你需要从 GitHub 下载最新的开发版本,因为在撰写本书时,该软件包仍在积极开发中:
devtools::install_github("DavisVaughan/furrr")
要使用 furrr 来并行化代码,我们调用 furrr::future_map 函数来代替在 6.1
中讨论过的 purrr::map 函数。但首先必须告诉 furrr 我们想要并行化的方式 ...
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

大规模数据分析和建模:基于 Spark 与 R

大规模数据分析和建模:基于 Spark 与 R

Javier Luraschi, Kevin Kuo, Edgar Ruiz
解密金融数据

解密金融数据

Justin Pauley
数据压缩入门

数据压缩入门

Colt McAnlis, Aleks Haecky

Publisher Resources

ISBN: 9787111656814