Muutke küpsiste eelistusi

Javascript for R [Pehme köide]

  • Formaat: Paperback / softback, 354 pages, kõrgus x laius: 234x156 mm, kaal: 453 g, 68 Line drawings, black and white; 68 Illustrations, black and white
  • Sari: Chapman & Hall/CRC The R Series
  • Ilmumisaeg: 16-Jul-2021
  • Kirjastus: Chapman & Hall/CRC
  • ISBN-10: 0367680637
  • ISBN-13: 9780367680633
  • Formaat: Paperback / softback, 354 pages, kõrgus x laius: 234x156 mm, kaal: 453 g, 68 Line drawings, black and white; 68 Illustrations, black and white
  • Sari: Chapman & Hall/CRC The R Series
  • Ilmumisaeg: 16-Jul-2021
  • Kirjastus: Chapman & Hall/CRC
  • ISBN-10: 0367680637
  • ISBN-13: 9780367680633

Little known to many, R works just as well with JavaScript—this book delves into the various ways both languages can work together. The ultimate aim of this work is to put the reader at ease with inviting JavaScript in their data science workflow. In that respect the book is not teaching one JavaScript but rather we show how little JavaScript can greatly support and enhance R code. Therefore, the focus is on integrating external JavaScript libraries and no prior knowledge of JavaScript is required.

Key Features:

? Easy to pick up.
? An entry way to learning JavaScript for R.
? Covers topics not covered anywhere else.
? Easy to follow along.

List of Figures
xv
Preface xix
I Basics and Roadmap
1(38)
1 Overview
3(8)
1.1 Rationale
3(3)
1.2 Methods
6(2)
1.2.1 V8
7(1)
1.2.2 htmlwidgets
7(1)
1.2.3 Shiny
7(1)
1.3 Methods Amiss
8(3)
1.3.1 reactR & vueR
8(1)
1.3.2 r2d3
9(2)
2 Prerequisites
11(28)
2.1 R Package Development
11(8)
2.1.1 Creating a Package
12(2)
2.1.2 Metadata
14(1)
2.1.3 R code
15(1)
2.1.4 Documentation
16(2)
2.1.5 Installed files
18(1)
2.1.6 Build, load, and install
18(1)
2.2 JSON
19(4)
2.2.1 Serialising
19(2)
2.2.2 Tabular Data
21(2)
2.3 JavaScript
23(6)
2.3.1 Developer Tools
23(1)
2.3.2 Variable Declaration and Scope
24(3)
2.3.3 Document Object Model
27(2)
2.4 Shiny
29(10)
2.4.1 Serving Static Files
29(4)
2.4.2 Htmltools
33(3)
2.4.3 Serving vs. htmltools
36(3)
II Data Visualisation
39(98)
3 Introduction to Widgets
41(8)
3.1 Plotly package
41(3)
3.2 DT package
44(2)
3.3 Crosstalk
46(1)
3.4 Wrap-up
47(2)
4 Basics of Building Widgets
49(8)
4.1 Read and Study
49(1)
4.2 Candidate Libraries
50(4)
4.2.1 Plotly.js
50(1)
4.2.2 Highchart.js
51(2)
4.2.3 Chart.js
53(1)
4.3 How It Works
54(3)
5 Your First Widget
57(10)
5.1 The Scaffold
57(2)
5.2 The HTML Output
59(2)
5.3 JavaScript Files
61(6)
6 A Realistic Widget
67(10)
6.1 Dependencies
68(2)
6.2 Implementation
70(5)
6.3 HTML Element
75(2)
7 The Full Monty
77(16)
7.1 Dependencies
78(2)
7.2 JavaScript
80(2)
7.3 Working with Data
82(3)
7.4 Transforming Data
85(4)
7.4.1 Using JavaScript
85(1)
7.4.2 Modify Serialiser
86(1)
7.4.3 Replace Serialiser
87(1)
7.4.4 Modify the Data
88(1)
7.4.5 Pros and Cons
88(1)
7.5 On Print Method
89(4)
8 Advanced Topics
93(20)
8.1 Shared Variables
93(4)
8.1.1 Sizing
94(2)
8.1.2 Sizing Policy
96(1)
8.2 Resizing
97(2)
8.3 Pre Render Hooks and Security
99(1)
8.4 JavaScript Code
100(1)
8.5 Prepend and Append Content
101(2)
8.6 Dependencies
103(5)
8.7 Compatibility
108(1)
8.8 Unit Tests
109(1)
8.9 Performances
109(4)
9 Linking Widgets
113(18)
9.1 Crosstalk Examples
113(4)
9.2 Crosstalk Requirements
117(1)
9.3 How it Works
118(2)
9.3.1 Keys
118(1)
9.3.2 Communication Lines
119(1)
9.3.3 Groups
120(1)
9.4 Crosstalk with Gio
120(1)
9.5 Rcode
121(3)
9.6 JavaScript Code
124(3)
9.6.1 Send Selected Keys
124(1)
9.6.2 Set Selected Keys
125(2)
9.7 Using Crosstalk with Gio
127(4)
10 Final Revisions
131(6)
10.1 Htmlwidgets and Data
131(2)
10.2 Plethora of Options
133(2)
10.3 Interface Design
135(1)
10.4 Exercises
136(1)
III Web Development with Shiny
137(116)
11 Bidirectional Communication
139(16)
11.1 WebSocket an Shiny
139(2)
11.2 Sessions
141(1)
11.3 Alerts, an example
142(13)
11.3.1 Explore
142(2)
11.3.2 From R to JavaScript
144(4)
11.3.3 Serialisation
148(2)
11.3.4 JavaScript to R
150(5)
12 A Complete Integration
155(22)
12.1 Discover
156(1)
12.2 Setup
156(1)
12.3 Dependencies
157(1)
12.4 Static Files
158(1)
12.5 Skeleton
159(2)
12.6 From R to JavaScript
161(2)
12.7 From JavaScript to R
163(3)
12.8 Input handler
166(3)
12.9 As a Package
169(8)
12.9.1 Dependencies
170(1)
12.9.2 Trigger classification
171(1)
12.9.3 JavaScript code
172(1)
12.9.4 Input handler
173(1)
12.9.5 Test
174(3)
13 Tips and Tricks
177(10)
13.1 Shiny Events
177(3)
13.2 Table Buttons
180(4)
13.3 jQuery
184(3)
14 Custom Outputs
187(22)
14.1 Inner-workings
188(1)
14.2 Setup
189(1)
14.3 Output R Function
190(1)
14.4 Generate Output HTML
190(3)
14.5 Output Renderer
193(1)
14.6 JavaScript Output Binding
194(5)
14.6.1 Boxxy Title
195(1)
14.6.2 Boxxy Value
196(1)
14.6.3 Boxxy Background Color
197(1)
14.6.4 Register the Output Binding
198(1)
14.7 Boxxy Usage
199(2)
14.8 Injecting Dependencies
201(6)
14.9 Preprocessing Custom Outputs
207(2)
15 Custom Inputs
209(16)
15.1 Setup
209(1)
15.2 Switch Input HTML and Style
210(2)
15.3 Generate Input HTML
212(2)
15.4 JavaScript Input Binding
214(8)
15.4.1 Find Inputs
214(1)
15.4.2 Get Input Id
215(1)
15.4.3 Get Input Value
215(1)
15.4.4 Set Input Value
216(1)
15.4.5 Receive Input Messages
216(1)
15.4.6 Subscribe and Unsubscribe Inputs
217(1)
15.4.7 Input Rate Policy
218(2)
15.4.8 Registering the Input Binding
220(2)
15.5 Update Input
222(2)
15.6 Exercise
224(1)
16 Cookies
225(6)
16.1 Discover js-cookie
225(1)
16.2 Setup Project
226(1)
16.3 JavaScript Cookies
227(1)
16.4 R Code
228(2)
16.5 Exercises
230(1)
17 Widgets with Shiny
231(22)
17.1 Widgets to R
231(4)
17.2 Input Handlers for Widgets
235(2)
17.3 R to Widgets
237(9)
17.3.1 Send Data from Widgets
240(1)
17.3.2 Retrieve Widget Instance
241(2)
17.3.3 Handle Data
243(3)
17.4 Proxy Function
246(1)
17.5 Clear Data
247(2)
17.6 Update the Widget
249(4)
IV JavaScript for Computations
253(20)
18 The V8 Engine
255(12)
18.1 Installation
255(1)
18.2 Basics
256(2)
18.3 External Libraries
258(4)
18.4 NPM Packages
262(1)
18.5 Use in Packages
263(4)
19 Machine Learning
267(6)
19.1 Dependency
267(1)
19.2 Simple Regression
268(4)
19.3 Exercises
272(1)
V Robust JavaScript
273(48)
20 Managing JavaScript
275(6)
20.1 Example
276(1)
20.2 Transpiling
277(1)
20.3 Minification
277(1)
20.4 Bundling and Modules
278(1)
20.5 Decoupling
279(1)
20.6 NPM
279(1)
20.7 With R
280(1)
21 Discover Webpack and NPM
281(16)
21.1 Installation
281(1)
21.1.1 Mac OS
281(1)
21.1.2 Ubuntu
282(1)
21.1.3 Windows
282(1)
21.1.4 Other
282(1)
21.2 Set Up the App
282(1)
21.3 Initialise NPM
283(1)
21.4 Installing NPM Packages
284(2)
21.5 Entry Point and Output
286(1)
21.6 Configuration File
287(1)
21.7 NPM scripts
287(1)
21.8 Source maps
288(1)
21.9 Bundle
289(1)
21.10 Internal Dependencies
290(1)
21.11 External Dependencies
291(1)
21.12 Import and Export
291(6)
21.12.1 Named
292(1)
21.12.2 Default
293(1)
21.12.3 Wrap-up
294(3)
22 Webpack with R
297(10)
22.1 Principles of packer
297(1)
22.2 Scaffolds
298(1)
22.3 Inputs
299(2)
22.4 Rfile
301(1)
22.5 JavaScript Files
302(2)
22.6 Bundle
304(3)
23 Webpack Advanced
307(14)
23.1 Widgets
307(5)
23.2 Shiny with Vue and Bootstrap 4
312(9)
23.2.1 Setup
312(3)
23.2.2 Bootstrap 4 Installation
315(1)
23.2.3 Vue Code
316(5)
VI Closing Remarks
321(6)
24 Conclusion
323(4)
24.1 Performances
323(1)
24.2 Trial and Error
324(1)
24.3 Functionality and UX
324(3)
Bibliography 327(4)
Index 331
John Coene has been working with R, and JavaScript for a number of years, and has worked for a variety of organisations ranging from large tech companies in China to International Organisations in Switzerland.