CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/features/r-statistical-software.tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Layout } from "antd";
7
8
import { Icon } from "@cocalc/frontend/components/icon";
9
import Code from "components/landing/code";
10
import Collaboration from "components/landing/collaboration";
11
import Contact from "components/landing/contact";
12
import Content from "components/landing/content";
13
import Footer from "components/landing/footer";
14
import Head from "components/landing/head";
15
import Header from "components/landing/header";
16
import Info from "components/landing/info";
17
import LaTeX from "components/landing/latex";
18
import Pitch from "components/landing/pitch";
19
import Publishing from "components/landing/publishing";
20
import SignIn from "components/landing/sign-in";
21
import Snapshots from "components/landing/snapshots";
22
import { Paragraph, Title } from "components/misc";
23
import A from "components/misc/A";
24
import { Customize } from "lib/customize";
25
import withCustomize from "lib/with-customize";
26
import rEnvironment from "public/features/cocalc-r-environment.png";
27
import jupyterCollab from "public/features/cocalc-r-jupyter-collaborate.png";
28
import rJupyter from "public/features/cocalc-r-jupyter.png";
29
import rLatex from "public/features/cocalc-r-latex.png";
30
import sidechat from "public/features/cocalc-r-side-chat.png";
31
import rcode from "public/features/cocalc-rcode.png";
32
import rmdDemo from "public/features/cocalc-rmd-demo-R-python3-plotting.png";
33
import logo from "public/features/r-logo.svg";
34
35
const component = "R";
36
const title = `Run ${component} Online`;
37
38
export default function R({ customize }) {
39
return (
40
<Customize value={customize}>
41
<Head title={"R Statistical Software"} />
42
<Layout>
43
<Header
44
page="features"
45
subPage="r-statistical-software"
46
runnableTag="R"
47
/>
48
<Layout.Content>
49
<Content
50
landing
51
startup={component}
52
body={logo}
53
title={title}
54
subtitle={
55
<>
56
Run <A href="https://www.r-project.org/">R code</A>,{" "}
57
<A href="#a-jupyternotebook">R in Jupyter notebooks</A>,
58
RMarkdown, or even{" "}
59
<A href="#a-latex">
60
Knitr/Rnw <LaTeX />
61
</A>{" "}
62
in a full, remote online R environment.
63
</>
64
}
65
subtitleBelow={true}
66
image={rJupyter}
67
alt={"Use of R in Jupyter"}
68
/>
69
70
<Pitch
71
col1={
72
<>
73
<Title level={3}>
74
<Icon name="pencil-alt" style={{ marginRight: "10px" }} />
75
CoCalc makes working with R easy
76
</Title>
77
<Paragraph>
78
CoCalc handles all the tedious details for you, regardless of
79
whether you want to work on the{" "}
80
<A href="/features/terminal">command line</A>, run{" "}
81
<A href="#a-jupyternotebook">Jupyter Notebooks</A>, create
82
RMarkdown files, or use{" "}
83
<A href="#a-latex">
84
Knitr in <LaTeX /> documents
85
</A>
86
.
87
</Paragraph>
88
<Paragraph>
89
This page is about ways to use R in the{" "}
90
<A href="../">CoCalc platform</A>.
91
</Paragraph>
92
</>
93
}
94
col2={
95
<>
96
<Title level={3}>
97
<Icon name="lightbulb" style={{ marginRight: "10px" }} /> Zero
98
setup
99
</Title>
100
<Paragraph>
101
<ul>
102
<li>
103
No need for you to download and install{" "}
104
<A href="https://www.r-project.org/">R</A>.
105
</li>
106
<li>
107
CoCalc already{" "}
108
<A href="/software/r">provides many packages</A> for you.
109
</li>
110
<li>
111
The <A href="/features/latex-editor">LaTeX editor</A> is
112
already integrated with R.
113
</li>
114
<li>
115
You no longer have to maintain everything on your own.
116
</li>
117
</ul>
118
</Paragraph>
119
<Paragraph>
120
Start working by creating or{" "}
121
<A href="https://doc.cocalc.com/howto/upload.html">
122
uploading R files
123
</A>
124
, RMarkdown documents, or{" "}
125
<A href="/features/jupyter-notebook">Jupyter notebooks</A>.
126
</Paragraph>
127
</>
128
}
129
/>
130
131
<SignIn startup={component} />
132
133
<Info.Heading
134
description={
135
<>There are many ways to use {component} online via CoCalc.</>
136
}
137
>
138
Feature Overview
139
</Info.Heading>
140
141
<Info
142
title="R in Jupyter Notebooks"
143
icon="ipynb"
144
image={rJupyter}
145
anchor="a-jupyternotebook"
146
alt={"Using R via the Jupyter notebook"}
147
>
148
<Paragraph>
149
CoCalc offers a{" "}
150
<strong>
151
<A href="/features/jupyter-notebook">complete rewrite</A>
152
</strong>{" "}
153
of the classical{" "}
154
<A href="http://jupyter.org/">Jupyter notebook</A> interface. It
155
is{" "}
156
<A href="http://doc.cocalc.com/jupyter.html">
157
tightly integrated into CoCalc
158
</A>{" "}
159
and adds real-time collaboration, TimeTravel history and more.
160
</Paragraph>
161
<Paragraph>
162
There is also support in CoCalc for easily using R with the{" "}
163
<A href="https://doc.cocalc.com/jupyter.html#classical-versus-cocalc">
164
classical Jupyter notebook and JupyterLab.
165
</A>
166
</Paragraph>
167
</Info>
168
169
<Collaboration image={jupyterCollab} />
170
171
<Info
172
title={
173
<>
174
Extensive <LaTeX /> support for R
175
</>
176
}
177
icon="tex"
178
image={rLatex}
179
anchor="a-latex"
180
alt="Using Knitr in CoCalc to create an R-enhanced LaTeX document."
181
below={
182
<>
183
<Paragraph>
184
This means you can move{" "}
185
<strong>your entire workflow online to CoCalc</strong>:
186
</Paragraph>
187
<Paragraph>
188
<ol>
189
<li>
190
<A href="https://doc.cocalc.com/howto/upload.html">
191
Upload
192
</A>{" "}
193
or fetch your datasets,
194
</li>
195
<li>
196
Use <A href="#a-jupyternotebook">Jupyter Notebooks</A> to
197
explore the data and test your hypothesis,
198
</li>
199
<li>
200
<A href="#a-chat">Discuss</A> and{" "}
201
<A href="#a-collaboration">collaborate</A> with your
202
research team,
203
</li>
204
<li>
205
Write your research paper in an <Code>.Rtex</Code> or{" "}
206
<Code>.Rnw</Code> document,
207
</li>
208
<li>
209
<A href="#a-publishing">Publish</A> your datasets, your
210
research code, and the PDF of your paper online, all
211
hosted on CoCalc.{" "}
212
</li>
213
</ol>
214
</Paragraph>
215
</>
216
}
217
>
218
<Paragraph>
219
The fully integrated{" "}
220
<A href="/features/latex-editor">
221
CoCalc <LaTeX /> editor
222
</A>{" "}
223
covers all your basic needs for working with <Code>.tex</Code>,{" "}
224
<Code>.Rnw</Code> and <Code>.Rtex</Code> files. The document is
225
synchronized with your collaborators in realtime and everyone sees
226
the same compiled PDF. In particular, this <LaTeX /> editor
227
</Paragraph>
228
<Paragraph>
229
<ul>
230
<li>Manages the entire compilation pipeline for you,</li>
231
<li>
232
Automatically processes{" "}
233
<strong>
234
<Code>.Rnw</Code> and <Code>.Rtex</Code> files
235
</strong>{" "}
236
using{" "}
237
<strong>
238
<A href="https://yihui.name/knitr/">Knitr</A>
239
</strong>
240
,
241
</li>
242
<li>
243
Supports{" "}
244
<strong>
245
<A href="https://doc.cocalc.com/latex-features.html#forward-inverse-search">
246
forward and inverse search
247
</A>
248
</strong>{" "}
249
to help you navigating in your document,
250
</li>
251
<li>
252
Captures and shows you{" "}
253
<strong>
254
where each <LaTeX /> or R error happened
255
</strong>
256
,
257
</li>
258
<li>
259
and you can use
260
<A href="https://doc.cocalc.com/time-travel.html">
261
TimeTravel
262
</A>
263
to go back in time to see your latest edits and{" "}
264
<strong>easily recover from a recent mistake</strong>.
265
</li>
266
</ul>
267
</Paragraph>
268
</Info>
269
270
<Info
271
title="RMarkdown support"
272
icon="markdown"
273
image={rmdDemo}
274
anchor="a-rmarkdown"
275
alt="An Rmarkdown document with a plot"
276
>
277
<Paragraph>
278
<strong>
279
You can edit{" "}
280
<A href="https://rmarkdown.rstudio.com/">RMarkdown files</A> in
281
CoCalc's code editor, as{" "}
282
<A href="https://doc.cocalc.com/frame-editor.html#edit-rmd">
283
explained here
284
</A>
285
.
286
</strong>
287
</Paragraph>
288
<Paragraph>
289
The source file is processed according to the YAML-frontmatter
290
configuration and the view of the generated file is automatically
291
updated in an HTML or PDF panel.
292
</Paragraph>
293
<Paragraph>
294
<strong>Syntax highlighting</strong> for markdown and embedded
295
programming code—according to their language—makes it easy to
296
visually understand the source file.
297
</Paragraph>
298
<Paragraph>
299
<A href="https://doc.cocalc.com/project-library.html">
300
CoCalc's library
301
</A>{" "}
302
features selected example files to get started quickly: e.g. HTML
303
reports, article templates and a beamer presentation.
304
</Paragraph>
305
</Info>
306
307
<Info
308
title="Code formatting"
309
icon="network-wired"
310
video={[
311
"features/cocalc-jupyter-r-format-cell.webm",
312
"features/cocalc-jupyter-r-format-cell.mp4",
313
]}
314
anchor="a-codeformatting"
315
alt="Video showing formatting of R in a Jupyter notebook"
316
>
317
<Paragraph>
318
<strong>CoCalc is able to format your R code.</strong>
319
</Paragraph>
320
<Paragraph>
321
By simply clicking one button,{" "}
322
<strong>
323
your R source code is formatted in a clean and consistent way
324
</strong>{" "}
325
using the{" "}
326
<A href="https://github.com/yihui/formatR#readme">
327
formatR package
328
</A>
329
.
330
</Paragraph>
331
<Paragraph>
332
This reduces cognitive load reading source code, brings everyone
333
in the team on the same page, and reduces misunderstandings.
334
</Paragraph>
335
<Paragraph>
336
R code formatting works with{" "}
337
<strong>
338
pure <code>.r</code> files
339
</strong>{" "}
340
and{" "}
341
<strong>
342
<A href="#a-jupyternotebook">Jupyter Notebooks</A> running an R
343
kernel
344
</strong>
345
.{" "}
346
</Paragraph>
347
</Info>
348
349
<Info
350
title={"Command line support"}
351
icon="terminal"
352
image={rcode}
353
anchor="a-commandline"
354
alt="Using R from a command line terminal"
355
>
356
<Paragraph>
357
All your existing R scripts run on the command line right in
358
CoCalc.{" "}
359
<A href="https://doc.cocalc.com/terminal.html">Open a Terminal</A>{" "}
360
and you find yourself in a familiar Linux shell with a local
361
filesystem for your data files, access to{" "}
362
<A href="https://www.git-scm.com">Git</A> and{" "}
363
<A href="/software/executables">a large number of commands...</A>{" "}
364
<strong>Feel at home and run your analysis as usual!</strong>
365
</Paragraph>
366
<Paragraph>
367
Terminals can be used <em>by multiple users at once</em>. This
368
means you can work with your collaborators in the same session at
369
the same time. Everyone sees the same output, and via{" "}
370
<A href="https://doc.cocalc.com/chat.html">side chat</A> next to
371
the terminal, the whole team can coordinate.
372
</Paragraph>
373
<Paragraph>
374
Beyond that, you can simultaneously work with several terminal
375
sessions. This gives you the ability to run your code
376
concurrently.
377
</Paragraph>
378
<Paragraph>
379
For long-running programs, you can even close your browser and
380
check on the result later.
381
</Paragraph>
382
</Info>
383
384
<Info
385
title="Chatrooms and side chat"
386
icon="comment"
387
image={sidechat}
388
anchor="a-chat"
389
alt="Chatting about an R Jupyter notebook"
390
>
391
<Paragraph>
392
Collaboration is a first class citizen on CoCalc. A{" "}
393
<A href="https://doc.cocalc.com/chat.html">side-by-side chat</A>{" "}
394
next to your R code, <LaTeX /> files and notebooks makes it easy
395
to discuss content with your colleagues or students. You can also
396
create dedicated chatrooms.
397
</Paragraph>
398
<Paragraph>
399
Avatars show who is currently working on a file.
400
</Paragraph>
401
<Paragraph>
402
Collaborators who are not online will be notified about new
403
messages the next time they sign in.
404
</Paragraph>
405
<Paragraph>
406
<A href="https://doc.cocalc.com/chat.html">Chat</A> also supports
407
markdown formatting and <LaTeX /> formulas.
408
</Paragraph>
409
</Info>
410
411
<Info
412
title="Managed R Environment"
413
icon="server"
414
image={rEnvironment}
415
anchor="a-environment"
416
alt="Exploring the stack of installed R packages in a Jupyter notebook"
417
>
418
<Paragraph>
419
CoCalc makes sure that the computational environment for R is
420
regularly updated and ready to work with. Our goal is enabling you
421
to get started with your analysis without any overhead.
422
</Paragraph>
423
<Paragraph>
424
Look at our <A href="/software/r">list of available packages</A>{" "}
425
in more detail. If something is missing, please tell us about it (
426
<Contact lower />) so we can install that package globally.
427
</Paragraph>
428
</Info>
429
430
<Publishing />
431
432
<Snapshots />
433
434
<Info
435
title="TimeTravel"
436
icon="history"
437
video={[
438
"features/cocalc-timetravel-r-jupyter-3x.webm",
439
"features/cocalc-timetravel-r-jupyter-3x.mp4",
440
]}
441
anchor="a-timetravel"
442
alt="Video showing the time travel slider in an R Jupyter notebook"
443
>
444
<Paragraph>
445
The{" "}
446
<strong>
447
<A href="https://doc.cocalc.com/time-travel.html">
448
TimeTravel feature
449
</A>
450
</strong>{" "}
451
is specific to the CoCalc platform. It records all your changes in
452
editable files like R source code, Jupyter notebook and <LaTeX />
453
documents in fine detail. You can go back and forth in time across
454
thousands of changes to recover your previous edits.
455
</Paragraph>
456
<Paragraph>
457
This allows you to easily recover any part of any version of your
458
file by copying and pasting. You can also see exactly what changed
459
from one version to the next.
460
</Paragraph>
461
<Paragraph>
462
You can visualize the entire process of creating a Jupyter
463
notebook from the start. This lets you discover how you arrived at
464
a particular solution and see what you (or your student) attempted
465
before the final solution.
466
</Paragraph>
467
</Info>
468
<SignIn startup={component} />
469
</Layout.Content>
470
<Footer />
471
</Layout>
472
</Customize>
473
);
474
}
475
476
export async function getServerSideProps(context) {
477
return await withCustomize({ context });
478
}
479
480