0% found this document useful (0 votes)
17 views

Intro_to_Jupyter_Notebooks

The document provides an introduction to using R with Jupyter Notebooks, highlighting its features, installation process, and benefits. It emphasizes the multi-language support of Jupyter, its real-time execution capabilities, and the ability to share notebooks via various platforms including Azure. Additionally, it outlines the integration of R and Python, as well as the use of Spark for data processing within Jupyter Notebooks.

Uploaded by

etest2272
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Intro_to_Jupyter_Notebooks

The document provides an introduction to using R with Jupyter Notebooks, highlighting its features, installation process, and benefits. It emphasizes the multi-language support of Jupyter, its real-time execution capabilities, and the ability to share notebooks via various platforms including Azure. Additionally, it outlines the integration of R and Python, as well as the use of Spark for data processing within Jupyter Notebooks.

Uploaded by

etest2272
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

An Introduction to R Jupyter (Azure) Notebooks

by Bryan Cafferky
SQL Saturday in Smithfield, RI
December 9th
http://www.sqlsaturday.com/694/EventHome.aspx

Use Discount
Pre Con: R from A to Z Code
https://r_programming.eventbrite.com Microsoft
For 20% Off
About Bryan Cafferky…
• Microsoft Technical Solutions Enabler

• Decades of IT Experience

• Microsoft Data Platform MVP

• Author of Pro PowerShell for Database Developers

• Experienced in health care, insurance, banking, and ecommerce

• Founded and lead PASS Chapter The RI Microsoft BI User Group and The SNE R User Group

• Proud to be a Nerd.

[email protected]

www.sql-fy.com

https://www.linkedin.com/in/bryancafferky

@BryanCafferky – follow me!


Time to
Find Your
Inner
Child!
What is Jupyter Notebook?
When to Use Notebooks?

Teaching Collaboration

Research Exploration
Why Use Notebooks?

75+ Languages Supported Sharing


Jupyter Notebook
Open Source

Written in Python – originally called IPython

Real time execution and rendering.

Many languages supported.

Supports Spark API (pySpark, SparkR)

Can share via GitHub, JupyterHub, and Azure.

Built-in Viewer Support in GitHub.


Common Funding = Common Benefit

It’s not
just for
Python
Anymore!
Who uses Jupyter Notebooks?
What’s in a name?

Emphasizes

Jupyter
multi-language
support.

R
Julia

Python
Why Notebook?

From Galileo’s
Notebook –
Drawing’s of
Jupiter’s
satellites.
Kernel Architecture

JSON format

Can be many kernels:


• Python
• R
• Julia
• Ruby
• Perl
• PowerShell

http://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html
Flexible Notebook Conversions

nbconvert

Formats include:
• HTML Slides
• PDF
• Markdown
• Script

http://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html
What is Jupyter Notebook?
Execute the cell

Command Prompt
called a cell

• Code executes in real


time.
Rich visualizations
rendered inline. • Can go back, edit and re-
run cells.

• Like a cross between a


command line and Excel
spreadsheet.
Starting Jupyter Notebook
Start the command shell.
Installing Jupyter Notebook
Start the Jupyter Notebook

Windows Command Prompt

Note: The notebook starts pointing to the folder from where the notebook was started.
The Jupyter Server Running
A First Look at a Notebook

Select New and the


kernel, i.e. R
A First Look at a Notebook

Kernel Running

Enter R code and


press Shift + Enter
Or
Click on
The Cell Toolbar

Save Move Cell Stop Cell


Cut Cell Copy Cell
Notebook Down 1 Execution

Run Code Set Cell


Paste Cells Move Restart the
Insert Cell in Selected Content
Below Cell(s) Up 1 Kernel
Cell(s) Type
• New notebook
• Sample notebooks
• Python
• R
• Cell Magic
• Widgets

Exploring
Jupyter…
http://jupyter.org/
• Documentation

• Free notebook play area


Use R and Python Together… Loads R
Python
Extension

%R to run R Default
code in the language is
cell Python 3

R ggplot call
passing data
frame, df, from
Python

%%R defines data to


be passed between R
and Python:
-i = Python to R
-o = R to Python
Accessing Spark with pyspark…

Import
pyspark
module
Set the
Resilient Spark
Distributed context
Dataset

Point
context to
HDFS file

Reads the
data in
Spark

Sample the
data
Presentations from Jupyter…

Switch to Organize
Slideshow Slides
Mode
Github Renders Notebooks Automatically…
Advanced Data Science Tool
Architecture
Features
Maximize Notebook Value

https://notebooks.azure.com/
To Install R
Packages
install.packages("psych", repo="http://cran.us.r-project.org")
Jupyter Notebooks on Azure

Expand/
Collapse
Control
Jupyter Notebooks on Azure

• Built-In Support to
maintain
notebooks.

• Share with others.

• Initially supports R,
Python 2 and
Python 3.
Jupyter Notebooks on Azure
Use the Gallery to Get a
Jump Start
Why Azure Notebooks?
Provides Custom Development IDE within the Azure Portal

Notebooks Can Access All Your Azure Resources

Share and Collaborate

Secure

One Tool for Any Language


RStudio Fights Back…

Expand/
Collapse
Control

Output
rendered in
the editor
Installing Additional R Packages
Install Pop Up in RStudio
• Installing additional R Packages

• Find out where R is installing packages.

• Find where Anaconda is installed. R packages are in subfolder \R\library


• Example: C:\Users\BryanCafferky\Anaconda3\R\library

• Copy the package folder from the R folder to the Anaconda folder.
How to get Jupyter Notebook…
Installing Jupyter Notebook
• Install Python – Jupyter is a Python application.

• Recommend the Anaconda distribution which has many useful packages.


• Choose 32 or 64 Bit as appropriate.
• Either Python 2.x or Python 3.x will work. Python 3 is the new standard.
https://www.continuum.io/downloads

• Install R if you do not have it installed. An R IDE is not required.

https://cran.r-project.org/bin/windows/base/
Installing Jupyter Notebook

Install the R Kernel with Extensions, i.e. popular R packages.


Windows Command Prompt
Jupyter Notebook – Wrapping Up
Key Features

Open Source

Written in Python – originally called IPython

Real time execution and rendering

Many languages supported

Supports Spark API

Sharing many ways, i.e. file system, GitHub, JupyterHub, Azure

Built-in Viewer Support in GitHub


Jupyter Notebooks – Wrapping Up
Questions?

You might also like