[1] 3 5 5 6 7 6 1 4 6 5 6 5 4 7 4 7 4 4 4 4
[1] "integer"
Week 6, Part 1
DSAN Summer Bootcamp 2024
Georgetown University
Tie yourself to the mast! Please!
Ulysses and the Sirens, J. W. Waterhouse (1891)
| Dive right into coding (Bc you think data science = coding) |
\(\implies\) | Spend 75% of your time wrestling with environment issues 😔 |
| Think about + set up environment before diving into coding | \(\implies\) | Spend 25% of your time wrestling with environment issues 😎 |
.ipynb)python <script>.py Environment! Create a bootcamp-w06 folder, and open this folder in VSCode!
Create a hello.py file, with the following content:
Now open Terminal (in VSCode: Right click in Explorer panel → “Open in Integrated Terminal”) and execute
You should see the following output:
Hello from Python!jupyter and press Enter….ipynb Files)python executable: all it does is
python <temporary file>.py.ipynb file itself(Make sure to terminate Jupyter using once you’re done using it!)
.Rmd)Rscript <script>.rCreate a hello.r file, with the following content:
Now open Terminal (in VSCode: Right click in Explorer panel → “Open in Integrated Terminal”) and execute
You should see the following output:
[1] "Hello from R!"(Plz notice the similarity with Python!)
.rmd) Files(Warning: Soon to be obsolete! Replaced by very similar .qmd, Quarto Markdown 😉)
Choose “New Blank File” → “R Markdown…” (in the Files Pane, bottom right of RStudio) to create hello.Rmd:
| Python | or | R | ❌😪 |
| Python | AND | R | ✅😎 |
.qmd (Quarto MarkDown) files: Markdown documents containing R and Python code!.Rmd)Rscript <script>.r.ipynb)python <script>.pyNumPy, SciPy, scikit-learnpurrr (for Python-style lambda functions)NumPy in Python)Don’t worry about the details of the code for now! Just note how…
rbinom() is built into R, whereas
[1] 3 5 5 6 7 6 1 4 6 5 6 5 4 7 4 7 4 4 4 4
[1] "integer"
How did I include both R and Python code (and its outputs) in the previous slide?
Quarto allows integration of R+Python via code blocks!
2024 DSAN Bootcamp W6.1: Intro to Quarto