diff --git a/docs/no_toc/01-intro-to-computing.md b/docs/no_toc/01-intro-to-computing.md new file mode 100644 index 0000000..ebcf137 --- /dev/null +++ b/docs/no_toc/01-intro-to-computing.md @@ -0,0 +1,317 @@ + + +# Intro to Computing + +Welcome to Introduction to Python! Each week, we cover a chapter, which consists of a lesson and exercise. In our first week together, we will look at big conceptual themes in programming, see how code is run, and learn some basic grammar structures of programming. + +## Goals of the course + +In the next 6 weeks, we will explore: + +- Fundamental concepts in high-level programming languages (Python, R, Julia, etc.) that is transferable: *How do programs run, and how do we solve problems using functions and data structures?* + +- Beginning of data science fundamentals: *How do you translate your scientific question to a data wrangling problem and answer it?* + + ![Data science workflow. Image source: [R for Data Science](https://r4ds.hadley.nz/whole-game).](https://d33wubrfki0l68.cloudfront.net/571b056757d68e6df81a3e3853f54d3c76ad6efc/32d37/diagrams/data-science.png){width="450"} + +- Find a nice balance between the two throughout the course: we will try to reproduce a figure from a scientific publication using new data. + +## What is a computer program? + +- A sequence of instructions to manipulate data for the computer to execute. + +- A series of translations: English \<-\> Programming Code for Interpreter \<-\> Machine Code for Central Processing Unit (CPU) + +We will focus on English \<-\> Programming Code for Python Interpreter in this class. + +More importantly: **How we organize ideas \<-\> Instructing a computer to do something**. + +## A programming language has following elements: {#a-programming-language-has-following-elements} + +- Grammar structure to construct expressions; combining expressions to create more complex expressions + +- Encapsulate complex expressions via **functions** to create modular and reusable tasks + +- Encapsulate complex data via **data structures** to allow efficient manipulation of data + +## Google Colab Setup + +Google Colab is a Integrated Development Environment (IDE) on a web browser. Think about it as Microsoft Word to a plain text editor. It provides extra bells and whistles to using Python that is easier for the user. + +Let's open up the KRAS analysis in Google Colab. If you are taking this course while it is in session, the project name is probably named "KRAS Demo" in your Google Classroom workspace. If you are taking this course on your own time, open up... + +Today, we will pay close attention to: + +- Python Console (Execution): Open it via View -\> Executed code history. You give it one line of Python code, and the console executes that single line of code; you give it a single piece of instruction, and it executes it for you. + +- Notebook: in the central panel of the website, you will see Python code interspersed with word document text. This is called a Python Notebook (other similar services include Jupyter Notebook, iPython Notebook), which has chunks of plain text *and* Python code, and it helps us understand better the code we are writing. + +- Variable Environment: Open it by clicking on the "{x}" button on the left-hand panel. Often, your code will store information in the Variable Environment, so that information can be reused. For instance, we often load in data and store it in the Variable Environment, and use it throughout rest of your Python code. + +The first thing we will do is see the different ways we can run Python code. You can do the following: + +1. Type something into the Python Console (Execution) and type enter, such as `2+2`. The Python Console will run it and give you an output. +2. Look through the Python Notebook, and when you see a chunk of Python Code, click the arrow button. It will copy the Python code chunk to the Python Console and run all of it. You will likely see variables created in the Variables panel as you load in and manipulate data. +3. Run every single Python code chunk via Runtime -\> Run all. + +Remember that the *order* that you run your code matters in programming. Your final product would be the result of Option 3, in which you run every Python code chunk from start to finish. However, sometimes it is nice to try out smaller parts of your code via Options 1 or 2. But you will be at risk of running your code out of order! + +To create your own content in the notebook, click on a section you want to insert content, and then click on "+ Code" or "+ Text" to add Python code or text, respectively. + +Python Notebook is great for data science work, because: + +- It encourages reproducible data analysis, when you run your analysis from start to finish. + +- It encourages excellent documentation, as you can have code, output from code, and prose combined together. + +- It is flexible to use other programming languages, such as R. + +Now, we will get to the basics of programming grammar. + +## Grammar Structure 1: Evaluation of Expressions + +- **Expressions** are be built out of **operations** or **functions**. + +- Functions and operations take in **data types**, do something with them, and return another data type. + +- We can combine multiple expressions together to form more complex expressions: an expression can have other expressions nested inside it. + +For instance, consider the following expressions entered to the Python Console: + + +``` python +18 + 21 +``` + +``` +## 39 +``` + +``` python +max(18, 21) +``` + +``` +## 21 +``` + +``` python +max(18 + 21, 65) +``` + +``` +## 65 +``` + +``` python +18 + (21 + 65) +``` + +``` +## 104 +``` + +``` python +len("ATCG") +``` + +``` +## 4 +``` + +Here, our input **data types** to the operation are **integer** in lines 1-4 and our input data type to the function is **string** in line 5. We will go over common data types shortly. + +Operations are just functions in hiding. We could have written: + + +``` python +from operator import add + +add(18, 21) +``` + +``` +## 39 +``` + +``` python +add(18, add(21, 65)) +``` + +``` +## 104 +``` + +Remember that the Python language is supposed to help us understand what we are writing in code easily, lending to *readable* code. Therefore, it is sometimes useful to come up with operations that is easier to read. (Because the `add()` function isn't typically used, it is not automatically available, so we used the import statement to load it in.) + +### Data types + +Here are some common data types we will be using in this course. + +| Data type name | **Data type shorthand** | **Examples** | +|----------------|:-----------------------:|:-----------------------:| +| Integer | int | 2, 4 | +| Float | float | 3.5, -34.1009 | +| String | str | "hello", "234-234-8594" | +| Boolean | bool | True, False | + +A nice way to summarize this first grammar structure is using the function machine schema, way back from algebra class: + +![Function machine from algebra class.](images/function_machine.png) + +Here are some aspects of this schema to pay attention to: + +- A programmer should not need to know how the function is implemented in order to use it - this emphasizes abstraction and modular thinking, a foundation in any programming language. + +- A function can have different kinds of inputs and outputs - it doesn't need to be numbers. In the `len()` function, the input is a String, and the output is an Integer. We will see increasingly complex functions with all sorts of different inputs and outputs. + +## Grammar Structure 2: Storing data types in the Variable Environment + +To build up a computer program, we need to store our returned data type from our expression somewhere for downstream use. We can assign a variable to it as follows: + + +``` python +x = 18 + 21 +``` + +If you enter this in the Console, you will see that in the Variable Environment, the variable `x` has a value of `39`. + +### Execution rule for variable assignment + +> Evaluate the expression to the right of `=`. +> +> Bind variable to the left of `=` to the resulting value. +> +> The variable is stored in the Variable Environment. + +The Variable Environment is where all the variables are stored, and can be used for an expression anytime once it is defined. Only one unique variable name can be defined. + +The variable is stored in the working memory of your computer, Random Access Memory (RAM). This is temporary memory storage on the computer that can be accessed quickly. Typically a personal computer has 8, 16, 32 Gigabytes of RAM. When we work with large datasets, if you assign a variable to a data type larger than the available RAM, it will not work. More on this later. + +Look, now `x` can be reused downstream: + + +``` python +x - 2 +``` + +``` +## 37 +``` + +``` python +y = x * 2 +``` + +It is quite common for programmers to not know what data type a variable is while they are coding. To learn about the data type of a variable, use the `type()` function on any variable in Python: + + +``` python +type(y) +``` + +``` +## +``` + +We should give useful variable names so that we know what to expect! Consider `num_sales` instead of `y`. + +## Grammar Structure 3: Evaluation of Functions + +Let's look at functions a little bit more formally: A function has a **function name**, **arguments**, and **returns** a data type. + +### Execution rule for functions: + +> Evaluate the function by its arguments, and if the arguments are functions or contains operations, evaluate those functions or operations first. +> +> The output of functions is called the **returned value**. + +Often, we will use multiple functions, in a nested way, or use parenthesis to change the order of operation. Being able to read nested operations, nested functions, and parenthesis is very important. Think about what the Python is going to do step-by--step in the line of code below: + + +``` python +(len("hello") + 4) * 2 +``` + +``` +## 18 +``` + +If we don't know how to use a function, such as `pow()` we can ask for help: + +``` +?pow + +pow(base, exp, mod=None) +Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments + +Some types, such as ints, are able to use a more efficient algorithm when +invoked using the three argument form. +``` + +This shows the function takes in three input arguments: `base`, `exp`, and `mod=None`. When an argument has an assigned value of `mod=None`, that means the input argument already has a value, and you don't need to specify anything, unless you want to. + +The following ways are equivalent ways of using the `pow()` function: + + +``` python +pow(2, 3) +``` + +``` +## 8 +``` + +``` python +pow(base=2, exp=3) +``` + +``` +## 8 +``` + +``` python +pow(exp=3, base=2) +``` + +``` +## 8 +``` + +but this will give you something different: + + +``` python +pow(3, 2) +``` + +``` +## 9 +``` + +And there is an operational equivalent: + + +``` python +2 ** 3 +``` + +``` +## 8 +``` + +## Tips on writing your first code + +`Computer = powerful + stupid` + +Even the smallest spelling and formatting changes will cause unexpected output and errors! + +- Write incrementally, test often + +- Check your assumptions, especially using new functions, operations, and new data types. + +- Live environments are great for testing, but not great for reproducibility. + +- Ask for help! + +To get more familiar with the errors Python gives you, take a look at this [summary of Python error messages](https://betterstack.com/community/guides/scaling-python/python-errors/). diff --git a/docs/no_toc/404.html b/docs/no_toc/404.html index 6145084..2c73718 100644 --- a/docs/no_toc/404.html +++ b/docs/no_toc/404.html @@ -4,18 +4,18 @@ - Page not found | Course Name + Page not found | Introduction to Python - + - + @@ -82,67 +82,44 @@ } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode - { } + { background-color: #f8f8f8; } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } -code span.al { color: #ff0000; font-weight: bold; } /* Alert */ -code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ -code span.at { color: #7d9029; } /* Attribute */ -code span.bn { color: #40a070; } /* BaseN */ -code span.bu { color: #008000; } /* BuiltIn */ -code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ -code span.ch { color: #4070a0; } /* Char */ -code span.cn { color: #880000; } /* Constant */ -code span.co { color: #60a0b0; font-style: italic; } /* Comment */ -code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ -code span.do { color: #ba2121; font-style: italic; } /* Documentation */ -code span.dt { color: #902000; } /* DataType */ -code span.dv { color: #40a070; } /* DecVal */ -code span.er { color: #ff0000; font-weight: bold; } /* Error */ +code span.al { color: #ef2929; } /* Alert */ +code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */ +code span.at { color: #204a87; } /* Attribute */ +code span.bn { color: #0000cf; } /* BaseN */ +code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */ +code span.ch { color: #4e9a06; } /* Char */ +code span.cn { color: #8f5902; } /* Constant */ +code span.co { color: #8f5902; font-style: italic; } /* Comment */ +code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */ +code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */ +code span.dt { color: #204a87; } /* DataType */ +code span.dv { color: #0000cf; } /* DecVal */ +code span.er { color: #a40000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ -code span.fl { color: #40a070; } /* Float */ -code span.fu { color: #06287e; } /* Function */ -code span.im { color: #008000; font-weight: bold; } /* Import */ -code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ -code span.kw { color: #007020; font-weight: bold; } /* Keyword */ -code span.op { color: #666666; } /* Operator */ -code span.ot { color: #007020; } /* Other */ -code span.pp { color: #bc7a00; } /* Preprocessor */ -code span.sc { color: #4070a0; } /* SpecialChar */ -code span.ss { color: #bb6688; } /* SpecialString */ -code span.st { color: #4070a0; } /* String */ -code span.va { color: #19177c; } /* Variable */ -code span.vs { color: #4070a0; } /* VerbatimString */ -code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ +code span.fl { color: #0000cf; } /* Float */ +code span.fu { color: #204a87; font-weight: bold; } /* Function */ +code span.im { } /* Import */ +code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */ +code span.kw { color: #204a87; font-weight: bold; } /* Keyword */ +code span.op { color: #ce5c00; font-weight: bold; } /* Operator */ +code span.ot { color: #8f5902; } /* Other */ +code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */ +code span.sc { color: #ce5c00; font-weight: bold; } /* SpecialChar */ +code span.ss { color: #4e9a06; } /* SpecialString */ +code span.st { color: #4e9a06; } /* String */ +code span.va { color: #000000; } /* Variable */ +code span.vs { color: #4e9a06; } /* VerbatimString */ +code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */ - @@ -157,58 +134,43 @@ @@ -218,7 +180,7 @@
@@ -227,16 +189,16 @@

- + + - -
- +
+

Page not found

@@ -250,17 +212,9 @@

Page not found

All illustrations CC-BY.
All other materials CC-BY unless noted otherwise. +
-

diff --git a/docs/no_toc/About.md b/docs/no_toc/About.md index f116ef2..c307ec3 100644 --- a/docs/no_toc/About.md +++ b/docs/no_toc/About.md @@ -51,7 +51,7 @@ These credits are based on our [course contributors table guidelines](https://ww ## collate en_US.UTF-8 ## ctype en_US.UTF-8 ## tz Etc/UTC -## date 2024-08-06 +## date 2024-08-07 ## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown) ## ## ─ Packages ─────────────────────────────────────────────────────────────────── diff --git a/docs/no_toc/a-new-chapter.html b/docs/no_toc/a-new-chapter.html deleted file mode 100644 index c1167ac..0000000 --- a/docs/no_toc/a-new-chapter.html +++ /dev/null @@ -1,610 +0,0 @@ - - - - - - - Chapter 2 A new chapter | Course Name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - -
-
- -
- - - - - - - - - -
- -
-
-

Chapter 2 A new chapter

-

If you haven’t yet read the getting started Wiki pages; start there.

-

To see the rendered version of this chapter and the rest of the template, see here: https://jhudatascience.org/OTTR_Template/.

-

Every chapter needs to start out with this chunk of code:

-
-

2.1 Learning Objectives

-

Every chapter also needs Learning objectives that will look like this:

-

This chapter will cover:

- -
-
-

2.2 Libraries

-

For this chapter, we’ll need the following packages attached:

-

*Remember to add any additional packages you need to your course’s own docker image.

-
library(magrittr)
-
-
-

2.3 Topic of Section

-

You can write all your text in sections like this, using ## to indicate a new header. you can use additional pound symbols to create lower levels of headers.

-

See here for additional general information about how you can format text within R Markdown files. In addition, see here for more in depth and advanced options.

-
-

2.3.1 Subtopic

-

Here’s a subheading (using three pound symbols) and some text in this subsection!

-
-
-
-

2.4 Code examples

-

You can demonstrate code like this:

-
output_dir <- file.path("resources", "code_output")
-if (!dir.exists(output_dir)) {
-  dir.create(output_dir)
-}
-

And make plots too:

-
hist_plot <- hist(iris$Sepal.Length)
-

-

You can also save these plots to file:

-
png(file.path(output_dir, "test_plot.png"))
-hist_plot
-
## $breaks
-## [1] 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
-## 
-## $counts
-## [1]  5 27 27 30 31 18  6  6
-## 
-## $density
-## [1] 0.06666667 0.36000000 0.36000000 0.40000000 0.41333333 0.24000000 0.08000000
-## [8] 0.08000000
-## 
-## $mids
-## [1] 4.25 4.75 5.25 5.75 6.25 6.75 7.25 7.75
-## 
-## $xname
-## [1] "iris$Sepal.Length"
-## 
-## $equidist
-## [1] TRUE
-## 
-## attr(,"class")
-## [1] "histogram"
-
dev.off()
-
## png 
-##   2
-
-
-

2.5 Image example

-

How to include a Google slide. It’s simplest to use the ottrpal package:

-

Major point!! example image

-

But if you have the slide or some other image locally downloaded you can also use HTML like this:

-

Major point!! example image

-
-
-

2.6 Video examples

-

You may also want to embed videos in your course. If alternatively, you just want to include a link you can do so like this:

-

Check out this link to a video using markdown syntax.

-
-

2.6.1 Using knitr

-

To embed videos in your course, you can use knitr::include_url() like this: -Note that you should use echo=FALSE in the code chunk because we don’t want the code part of this to show up. If you are unfamiliar with how R Markdown code chunks work, read this.

- -
-
-

2.6.2 Using HTML

- -
-
-

2.6.3 Using knitr

- -
-
-

2.6.4 Using HTML

- -
-
-
-

2.7 Website Examples

-

Yet again you can use a link to a website like so:

-

A Website

-

You might want to have users open a website in a new tab by default, especially if they need to reference both the course and a resource at once.

-

A Website

-

Or, you can embed some websites.

-
-

2.7.1 Using knitr

-

This works:

- -
-
-

2.7.2 Using HTML

- -

If you’d like the URL to show up in a new tab you can do this:

-
<a href="https://www.linkedin.com" target="_blank">LinkedIn</a>
-
-
-
-

2.8 Citation examples

-

We can put citations at the end of a sentence like this (Allaire et al. 2021). -Or multiple citations Xie, Allaire, and Grolemund (2018).

-

but they need a ; separator (Allaire et al. 2021; Xie, Allaire, and Grolemund 2018).

-

In text, we can put citations like this Allaire et al. (2021).

-
-
-

2.9 Stylized boxes

-

Occasionally, you might find it useful to emphasize a particular piece of information. To help you do so, we have provided css code and images (no need for you to worry about that!) to create the following stylized boxes.

-

You can use these boxes in your course with either of two options: using HTML code or Pandoc syntax.

-
-

2.9.1 Using rmarkdown container syntax

-

The rmarkdown package allows for a different syntax to be converted to the HTML that you just saw and also allows for conversion to LaTeX. See the Bookdown documentation for more information (Xie, Dervieux, and Riederer 2020). Note that Bookdown uses Pandoc.

-
::: {.notice}
-Note using rmarkdown syntax.
-
-:::
-
-

Note using rmarkdown syntax.

-
-

As an example you might do something like this:

-
-

Please click on the subsection headers in the left hand -navigation bar (e.g., 2.1, 4.3) a second time to expand the -table of contents and enable the scroll_highlight feature -(see more)

-
-
-
-

2.9.2 Using HTML

-

To add a warning box like the following use:

-
<div class = "notice">
-Followed by the text you want inside
-</div>
-

This will create the following:

-
-

Followed by the text you want inside

-
-

Here is a <div class = "warning"> box:

-
-

Note text

-
-

Here is a <div class = "github"> box:

-
-

GitHub text

-
-

Here is a <div class = "dictionary"> box:

-
-

dictionary text

-
-

Here is a <div class = "reflection"> box:

-
-

reflection text

-
-

Here is a <div class = "wip"> box:

-
-

Work in Progress text

-
-
-
- - -
-

References

-
-
-Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2021. Rmarkdown: Dynamic Documents for r. https://github.com/rstudio/rmarkdown. -
-
-Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown. -
-
-Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook. -
-
-
-
- -
- -
- -
-
-
- - -
-
- - - - - - - - - - - - - diff --git a/docs/no_toc/about-the-authors.html b/docs/no_toc/about-the-authors.html index 4f2cda8..434bafb 100644 --- a/docs/no_toc/about-the-authors.html +++ b/docs/no_toc/about-the-authors.html @@ -4,18 +4,18 @@ - About the Authors | Course Name + About the Authors | Introduction to Python - + - + @@ -28,7 +28,7 @@ - + @@ -82,67 +82,44 @@ } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode - { } + { background-color: #f8f8f8; } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } -code span.al { color: #ff0000; font-weight: bold; } /* Alert */ -code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ -code span.at { color: #7d9029; } /* Attribute */ -code span.bn { color: #40a070; } /* BaseN */ -code span.bu { color: #008000; } /* BuiltIn */ -code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ -code span.ch { color: #4070a0; } /* Char */ -code span.cn { color: #880000; } /* Constant */ -code span.co { color: #60a0b0; font-style: italic; } /* Comment */ -code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ -code span.do { color: #ba2121; font-style: italic; } /* Documentation */ -code span.dt { color: #902000; } /* DataType */ -code span.dv { color: #40a070; } /* DecVal */ -code span.er { color: #ff0000; font-weight: bold; } /* Error */ +code span.al { color: #ef2929; } /* Alert */ +code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */ +code span.at { color: #204a87; } /* Attribute */ +code span.bn { color: #0000cf; } /* BaseN */ +code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */ +code span.ch { color: #4e9a06; } /* Char */ +code span.cn { color: #8f5902; } /* Constant */ +code span.co { color: #8f5902; font-style: italic; } /* Comment */ +code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */ +code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */ +code span.dt { color: #204a87; } /* DataType */ +code span.dv { color: #0000cf; } /* DecVal */ +code span.er { color: #a40000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ -code span.fl { color: #40a070; } /* Float */ -code span.fu { color: #06287e; } /* Function */ -code span.im { color: #008000; font-weight: bold; } /* Import */ -code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ -code span.kw { color: #007020; font-weight: bold; } /* Keyword */ -code span.op { color: #666666; } /* Operator */ -code span.ot { color: #007020; } /* Other */ -code span.pp { color: #bc7a00; } /* Preprocessor */ -code span.sc { color: #4070a0; } /* SpecialChar */ -code span.ss { color: #bb6688; } /* SpecialString */ -code span.st { color: #4070a0; } /* String */ -code span.va { color: #19177c; } /* Variable */ -code span.vs { color: #4070a0; } /* VerbatimString */ -code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ +code span.fl { color: #0000cf; } /* Float */ +code span.fu { color: #204a87; font-weight: bold; } /* Function */ +code span.im { } /* Import */ +code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */ +code span.kw { color: #204a87; font-weight: bold; } /* Keyword */ +code span.op { color: #ce5c00; font-weight: bold; } /* Operator */ +code span.ot { color: #8f5902; } /* Other */ +code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */ +code span.sc { color: #ce5c00; font-weight: bold; } /* SpecialChar */ +code span.ss { color: #4e9a06; } /* SpecialString */ +code span.st { color: #4e9a06; } /* String */ +code span.va { color: #000000; } /* Variable */ +code span.vs { color: #4e9a06; } /* VerbatimString */ +code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */ - @@ -157,58 +134,43 @@ @@ -218,7 +180,7 @@
@@ -227,16 +189,16 @@

- + + - -

- + diff --git a/docs/no_toc/assets/big-dasl-stacked.png b/docs/no_toc/assets/big-dasl-stacked.png new file mode 100644 index 0000000..4bf74fc Binary files /dev/null and b/docs/no_toc/assets/big-dasl-stacked.png differ diff --git a/docs/no_toc/assets/box_images/terminal.png b/docs/no_toc/assets/box_images/terminal.png new file mode 100644 index 0000000..0d27b26 Binary files /dev/null and b/docs/no_toc/assets/box_images/terminal.png differ diff --git a/docs/no_toc/assets/dasl_thin_main_image.png b/docs/no_toc/assets/dasl_thin_main_image.png old mode 100755 new mode 100644 index 2884072..6143f4f Binary files a/docs/no_toc/assets/dasl_thin_main_image.png and b/docs/no_toc/assets/dasl_thin_main_image.png differ diff --git a/docs/no_toc/assets/style.css b/docs/no_toc/assets/style.css index 78e076e..4efb311 100755 --- a/docs/no_toc/assets/style.css +++ b/docs/no_toc/assets/style.css @@ -1,4 +1,4 @@ -@import url('https://fonts.googleapis.com/css?family=Abril+Fatface|Karla:400,400i,700,700i|Lora:400,400i,700,700i&display=swap'); +@import url('https://fonts.googleapis.com/css?family=Abril+Fatface|Arimo:400,400i,700,700i|Tinos:400,400i,700,700i&display=swap'); p.caption { color: #777; @@ -43,18 +43,18 @@ pre code { /* ------------Links------------------ */ .book .book-body .page-wrapper .page-inner section.normal a { - color: #68ace5; + color: #00C1D5; } /*------------- Body and header text---------------- */ .book.font-family-1 { - font-family: 'Karla', arial, sans-serif; + font-family: Arial, 'Arimo', sans-serif; } h1, h2, h3, h4 { - font-family: 'Lora', arial, sans-serif; + font-family: 'Times New Roman', 'Tinos', serif; } @@ -69,16 +69,16 @@ h1, h2, h3, h4 { } .title { - font-family: 'Lora'; + font-family: 'Times New Roman', 'Tinos', serif; font-size: 4em !important; - color: #012d72; + color: #1B365D; margin-top: 0.275em !important; margin-bottom: 0.35em !important; } .subtitle { - font-family: 'Lora'; - color: #0b8d96; + font-family: 'Times New Roman', 'Tinos', serif; + color: #1B365D; } @@ -99,7 +99,7 @@ h1, h2, h3, h4 { */ .section.level1 > p:first-of-type:first-letter { /*drop cap for first p beneath level 1 headers only within class .section*/ - color: #012d72; + color: #1B365D; float: left; font-family: 'Abril Fatface', serif; font-size: 7em; @@ -138,11 +138,11 @@ h1, h2, h3, h4 { /*---color of links in TOC----*/ .book .book-summary a { -color: #012d72 +color: #1B365D } .summary{ - font-family: 'Karla', sans-serif; + font-family: Arial, 'Arimo', sans-serif; } /* all TOC list items, basically */ @@ -152,20 +152,38 @@ color: #012d72 padding-bottom: 8px; padding-left: 15px; padding-right: 15px; - color: #012d72; + color: #1B365D; } .summary a:hover { - color: #68ace5 !important; + color: #00C1D5 !important; } .book .book-summary ul.summary li.active>a { /*active TOC links*/ - color: #68ace5 !important; + color: #00C1D5 !important; border-left: solid 4px; - border-color: #68ace5; + border-color: #00C1D5; padding-left: 11px !important; } +.trapezoid { + width: 132px; + text-align: center; + position: relative; + left: 10px; + border-right: 50px solid #ffb809; + border-bottom: 50px solid #dbdbdb; + border-left: 50px solid #b842ca; + box-sizing: content-box; +} +.trapezoid span { + position: absolute; + top: 8px; + bottom: 5px; + left: 5%; + color: #dbdbdb; +} + li.appendix span, li.part span { /* for TOC part names */ margin-top: 1em; @@ -246,11 +264,19 @@ li.appendix span, li.part span { /* for TOC part names */ width: 50%; } +.click_to_expand_block { + padding: 1em; + padding-top: .5em; + border: 1px grey; + background: #E8E8E8; + color: black; +} /* Sidebar formating --------------------------------------------*/ /* from r-pkgs.org*/ -div.notice, div.warning, div.github, div.dictionary, div.reflection, div.wip { +div.notice, div.warning, div.github, div.dictionary, div.reflection, div.terminal { + border-style: solid; padding: 1em; margin: 1em 0; padding-left: 100px; @@ -259,18 +285,15 @@ div.notice, div.warning, div.github, div.dictionary, div.reflection, div.wip { } div.notice{ - border: 4px #68ace5; - border-style: solid; + border: 4px #00C1D5; background-size: 70px; background-position: 15px center; background-color: #e8ebee; background-image: url("../assets/box_images/note.png"); } - div.warning{ border: 4px #e0471c; - border-style: solid; background-size: 70px; background-position: 15px center; background-color: #e8ebee; @@ -279,7 +302,6 @@ div.warning{ div.github{ border: 4px #000000; - border-style: solid; background-size: 70px; background-position: 15px center; background-color: #e8ebee; @@ -287,8 +309,7 @@ div.github{ } div.dictionary{ - border: 4px #68ace5; - border-style: solid; + border: 4px #00C1D5; background-size: 70px; background-position: 15px center; background-color: #e8ebee; @@ -296,23 +317,22 @@ div.dictionary{ } div.reflection{ - border: 4px #68ace5; - border-style: solid; + border: 4px #00C1D5; background-size: 90px; background-position: 15px center; background-color: #e8ebee; background-image: url("../assets/box_images/thinking_face.png"); } -div.wip{ - border: 4px #000000; - border-style: solid; +div.terminal{ + border: 4px #00C1D5; background-size: 70px; background-position: 15px center; - background-color: #f4d03f; - background-image: url("../assets/box_images/under_construction.png"); + background-color: #e8ebee; + background-image: url("../assets/box_images/terminal.png"); } + /* .book .book-body .page-wrapper .page-inner section.normal is needed to override the styles produced by gitbook, which are ridiculously overspecified. Goal of the selectors is to ensure internal "margins" @@ -432,10 +452,33 @@ a.anchor:hover { /* Footer */ .footer { - font-family: "Lora", serif; + font-family: 'Times New Roman', 'Tinos', serif; font-size: .85em; color: #193a5c; } + +/* AnVIL style */ +/* Things above this comment should be identical to OTTR_Template style.css */ +/* Things below this comment are AnVIL customizations */ + +.hero-image-container { + height: 100px; +} + +.page-inner { + padding-top: 60px !important; +} + +.book .book-body .page-wrapper .page-inner section.normal h1, +.book .book-body .page-wrapper .page-inner section.normal h2, +.book .book-body .page-wrapper .page-inner section.normal h3, +.book .book-body .page-wrapper .page-inner section.normal h4, +.book .book-body .page-wrapper .page-inner section.normal h5, +.book .book-body .page-wrapper .page-inner section.normal h6 { + margin-top: 1em; + margin-bottom: 1em; +} + /*Get rid of TOC stuff from https://github.com/rstudio/bookdown/issues/1251 */ .book .book-body .page-wrapper .page-inner { @@ -454,18 +497,6 @@ a.anchor:hover { width: 0% !important; } - - .book-body.fixed > div > .book-header.fixed > a:nth-child(1) { visibility: hidden; } - -.fa-angle-right:before { - color: #FFFFFF; - font-size:0em !important; -} - -.fa-angle-left:before { - color: #FFFFFF; - font-size:0em !important; -} diff --git a/docs/no_toc/images/function_machine.png b/docs/no_toc/images/function_machine.png new file mode 100644 index 0000000..2bb7d9f Binary files /dev/null and b/docs/no_toc/images/function_machine.png differ diff --git a/docs/no_toc/index.html b/docs/no_toc/index.html index c0d3cd9..9e6b078 100644 --- a/docs/no_toc/index.html +++ b/docs/no_toc/index.html @@ -4,18 +4,18 @@ - Course Name + Introduction to Python - + - + @@ -29,7 +29,7 @@ - + @@ -82,67 +82,44 @@ } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode - { } + { background-color: #f8f8f8; } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } -code span.al { color: #ff0000; font-weight: bold; } /* Alert */ -code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ -code span.at { color: #7d9029; } /* Attribute */ -code span.bn { color: #40a070; } /* BaseN */ -code span.bu { color: #008000; } /* BuiltIn */ -code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ -code span.ch { color: #4070a0; } /* Char */ -code span.cn { color: #880000; } /* Constant */ -code span.co { color: #60a0b0; font-style: italic; } /* Comment */ -code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ -code span.do { color: #ba2121; font-style: italic; } /* Documentation */ -code span.dt { color: #902000; } /* DataType */ -code span.dv { color: #40a070; } /* DecVal */ -code span.er { color: #ff0000; font-weight: bold; } /* Error */ +code span.al { color: #ef2929; } /* Alert */ +code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */ +code span.at { color: #204a87; } /* Attribute */ +code span.bn { color: #0000cf; } /* BaseN */ +code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */ +code span.ch { color: #4e9a06; } /* Char */ +code span.cn { color: #8f5902; } /* Constant */ +code span.co { color: #8f5902; font-style: italic; } /* Comment */ +code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */ +code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */ +code span.dt { color: #204a87; } /* DataType */ +code span.dv { color: #0000cf; } /* DecVal */ +code span.er { color: #a40000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ -code span.fl { color: #40a070; } /* Float */ -code span.fu { color: #06287e; } /* Function */ -code span.im { color: #008000; font-weight: bold; } /* Import */ -code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ -code span.kw { color: #007020; font-weight: bold; } /* Keyword */ -code span.op { color: #666666; } /* Operator */ -code span.ot { color: #007020; } /* Other */ -code span.pp { color: #bc7a00; } /* Preprocessor */ -code span.sc { color: #4070a0; } /* SpecialChar */ -code span.ss { color: #bb6688; } /* SpecialString */ -code span.st { color: #4070a0; } /* String */ -code span.va { color: #19177c; } /* Variable */ -code span.vs { color: #4070a0; } /* VerbatimString */ -code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ +code span.fl { color: #0000cf; } /* Float */ +code span.fu { color: #204a87; font-weight: bold; } /* Function */ +code span.im { } /* Import */ +code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */ +code span.kw { color: #204a87; font-weight: bold; } /* Keyword */ +code span.op { color: #ce5c00; font-weight: bold; } /* Operator */ +code span.ot { color: #8f5902; } /* Other */ +code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */ +code span.sc { color: #ce5c00; font-weight: bold; } /* SpecialChar */ +code span.ss { color: #4e9a06; } /* SpecialString */ +code span.st { color: #4e9a06; } /* String */ +code span.va { color: #000000; } /* Variable */ +code span.vs { color: #4e9a06; } /* VerbatimString */ +code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */ - @@ -157,58 +134,43 @@ @@ -218,7 +180,7 @@
@@ -227,32 +189,41 @@

- + + - -
- +
+

About this Course

-
-

0.1 Available course formats

-

This course is available in multiple formats which allows you to take it in the way that best suites your needs. You can take it for certificate which can be for free or fee.

- +
+

0.1 Curriculum

+

The course covers fundamentals of Python, a high-level programming language, and use it to wrangle data for analysis and visualization.

+
+
+

0.2 Target Audience

+

The course is intended for researchers who want to learn coding for the first time with a data science application via the Python language. This course is also appropriate for folks who have explored data science or programming on their own and want to focus on some fundamentals.

+
+
+

0.3 Learning Objectives

+

Analyze Tidy datasets in the Python programming language via data subsetting, joining, and transformations.

+

Evaluate summary statistics and data visualization to understand scientific questions.

+

Describe how the Python programming environment interpret complex expressions made out of functions, operations, and data structures, in a step-by-step way.

+

Apply problem solving strategies to debug broken code.

+
+
+

0.4 Offerings

+

This course is taught on a regular basis at Fred Hutch Cancer Center through the Data Science Lab. Announcements of course offering can be found here.

@@ -262,24 +233,16 @@

0.1 Available course formatsCC-BY.
All other materials CC-BY unless noted otherwise. +

-

- + diff --git a/docs/no_toc/index.md b/docs/no_toc/index.md index a64dd4a..bdb6e62 100644 --- a/docs/no_toc/index.md +++ b/docs/no_toc/index.md @@ -1,5 +1,5 @@ --- -title: "Course Name" +title: "Introduction to Python" date: "August, 2024" site: bookdown::bookdown_site documentclass: book @@ -13,14 +13,26 @@ output: toc: true --- -# About this Course {-} +# About this Course {.unnumbered} +## Curriculum -## Available course formats +The course covers fundamentals of Python, a high-level programming language, and use it to wrangle data for analysis and visualization. -This course is available in multiple formats which allows you to take it in the way that best suites your needs. You can take it for certificate which can be for free or fee. +## Target Audience -- The material for this course can be viewed without login requirement on this [Bookdown website](LINK HERE). This format might be most appropriate for you if you rely on screen-reader technology. -- This course can be taken for [free certification through Leanpub](LINK HERE). -- This course can be taken on [Coursera for certification here](LINK HERE) (but it is not available for free on Coursera). -- Our courses are open source, you can find the [source material for this course on GitHub](LINK HERE). +The course is intended for researchers who want to learn coding for the first time with a data science application via the Python language. This course is also appropriate for folks who have explored data science or programming on their own and want to focus on some fundamentals. + +## Learning Objectives + +**Analyze** Tidy datasets in the Python programming language via data subsetting, joining, and transformations. + +**Evaluate** summary statistics and data visualization to understand scientific questions. + +**Describe** how the Python programming environment interpret complex expressions made out of functions, operations, and data structures, in a step-by-step way. + +**Apply** problem solving strategies to debug broken code. + +## Offerings + +This course is taught on a regular basis at [Fred Hutch Cancer Center](https://www.fredhutch.org/) through the [Data Science Lab](https://hutchdatascience.org/). Announcements of course offering can be found [here](https://hutchdatascience.org/training/). diff --git a/docs/no_toc/intro-to-computing.html b/docs/no_toc/intro-to-computing.html new file mode 100644 index 0000000..dcc75b6 --- /dev/null +++ b/docs/no_toc/intro-to-computing.html @@ -0,0 +1,480 @@ + + + + + + + Chapter 1 Intro to Computing | Introduction to Python + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + +
+
+ +
+ + + + + + + + + +
+ +
+
+

Chapter 1 Intro to Computing

+

Welcome to Introduction to Python! Each week, we cover a chapter, which consists of a lesson and exercise. In our first week together, we will look at big conceptual themes in programming, see how code is run, and learn some basic grammar structures of programming.

+
+

1.1 Goals of the course

+

In the next 6 weeks, we will explore:

+
    +
  • Fundamental concepts in high-level programming languages (Python, R, Julia, etc.) that is transferable: How do programs run, and how do we solve problems using functions and data structures?

  • +
  • Beginning of data science fundamentals: How do you translate your scientific question to a data wrangling problem and answer it?

    +
    +Data science workflow. Image source: R for Data Science. +
    Data science workflow. Image source: R for Data Science.
    +
  • +
  • Find a nice balance between the two throughout the course: we will try to reproduce a figure from a scientific publication using new data.

  • +
+
+
+

1.2 What is a computer program?

+
    +
  • A sequence of instructions to manipulate data for the computer to execute.

  • +
  • A series of translations: English <-> Programming Code for Interpreter <-> Machine Code for Central Processing Unit (CPU)

  • +
+

We will focus on English <-> Programming Code for Python Interpreter in this class.

+

More importantly: How we organize ideas <-> Instructing a computer to do something.

+
+
+

1.3 A programming language has following elements:

+
    +
  • Grammar structure to construct expressions; combining expressions to create more complex expressions

  • +
  • Encapsulate complex expressions via functions to create modular and reusable tasks

  • +
  • Encapsulate complex data via data structures to allow efficient manipulation of data

  • +
+
+
+

1.4 Google Colab Setup

+

Google Colab is a Integrated Development Environment (IDE) on a web browser. Think about it as Microsoft Word to a plain text editor. It provides extra bells and whistles to using Python that is easier for the user.

+

Let’s open up the KRAS analysis in Google Colab. If you are taking this course while it is in session, the project name is probably named “KRAS Demo” in your Google Classroom workspace. If you are taking this course on your own time, open up…

+

Today, we will pay close attention to:

+
    +
  • Python Console (Execution): Open it via View -> Executed code history. You give it one line of Python code, and the console executes that single line of code; you give it a single piece of instruction, and it executes it for you.

  • +
  • Notebook: in the central panel of the website, you will see Python code interspersed with word document text. This is called a Python Notebook (other similar services include Jupyter Notebook, iPython Notebook), which has chunks of plain text and Python code, and it helps us understand better the code we are writing.

  • +
  • Variable Environment: Open it by clicking on the “{x}” button on the left-hand panel. Often, your code will store information in the Variable Environment, so that information can be reused. For instance, we often load in data and store it in the Variable Environment, and use it throughout rest of your Python code.

  • +
+

The first thing we will do is see the different ways we can run Python code. You can do the following:

+
    +
  1. Type something into the Python Console (Execution) and type enter, such as 2+2. The Python Console will run it and give you an output.
  2. +
  3. Look through the Python Notebook, and when you see a chunk of Python Code, click the arrow button. It will copy the Python code chunk to the Python Console and run all of it. You will likely see variables created in the Variables panel as you load in and manipulate data.
  4. +
  5. Run every single Python code chunk via Runtime -> Run all.
  6. +
+

Remember that the order that you run your code matters in programming. Your final product would be the result of Option 3, in which you run every Python code chunk from start to finish. However, sometimes it is nice to try out smaller parts of your code via Options 1 or 2. But you will be at risk of running your code out of order!

+

To create your own content in the notebook, click on a section you want to insert content, and then click on “+ Code” or “+ Text” to add Python code or text, respectively.

+

Python Notebook is great for data science work, because:

+
    +
  • It encourages reproducible data analysis, when you run your analysis from start to finish.

  • +
  • It encourages excellent documentation, as you can have code, output from code, and prose combined together.

  • +
  • It is flexible to use other programming languages, such as R.

  • +
+

Now, we will get to the basics of programming grammar.

+
+
+

1.5 Grammar Structure 1: Evaluation of Expressions

+
    +
  • Expressions are be built out of operations or functions.

  • +
  • Functions and operations take in data types, do something with them, and return another data type.

  • +
  • We can combine multiple expressions together to form more complex expressions: an expression can have other expressions nested inside it.

  • +
+

For instance, consider the following expressions entered to the Python Console:

+
18 + 21
+
## 39
+
max(18, 21)
+
## 21
+
max(18 + 21, 65)
+
## 65
+
18 + (21 + 65)
+
## 104
+
len("ATCG")
+
## 4
+

Here, our input data types to the operation are integer in lines 1-4 and our input data type to the function is string in line 5. We will go over common data types shortly.

+

Operations are just functions in hiding. We could have written:

+
from operator import add
+
+add(18, 21)
+
## 39
+
add(18, add(21, 65))
+
## 104
+

Remember that the Python language is supposed to help us understand what we are writing in code easily, lending to readable code. Therefore, it is sometimes useful to come up with operations that is easier to read. (Because the add() function isn’t typically used, it is not automatically available, so we used the import statement to load it in.)

+
+

1.5.1 Data types

+

Here are some common data types we will be using in this course.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Data type nameData type shorthandExamples
Integerint2, 4
Floatfloat3.5, -34.1009
Stringstr“hello”, “234-234-8594”
BooleanboolTrue, False
+

A nice way to summarize this first grammar structure is using the function machine schema, way back from algebra class:

+
+Function machine from algebra class. +
Function machine from algebra class.
+
+

Here are some aspects of this schema to pay attention to:

+
    +
  • A programmer should not need to know how the function is implemented in order to use it - this emphasizes abstraction and modular thinking, a foundation in any programming language.

  • +
  • A function can have different kinds of inputs and outputs - it doesn’t need to be numbers. In the len() function, the input is a String, and the output is an Integer. We will see increasingly complex functions with all sorts of different inputs and outputs.

  • +
+
+
+
+

1.6 Grammar Structure 2: Storing data types in the Variable Environment

+

To build up a computer program, we need to store our returned data type from our expression somewhere for downstream use. We can assign a variable to it as follows:

+
x = 18 + 21
+

If you enter this in the Console, you will see that in the Variable Environment, the variable x has a value of 39.

+
+

1.6.1 Execution rule for variable assignment

+
+

Evaluate the expression to the right of =.

+

Bind variable to the left of = to the resulting value.

+

The variable is stored in the Variable Environment.

+
+

The Variable Environment is where all the variables are stored, and can be used for an expression anytime once it is defined. Only one unique variable name can be defined.

+

The variable is stored in the working memory of your computer, Random Access Memory (RAM). This is temporary memory storage on the computer that can be accessed quickly. Typically a personal computer has 8, 16, 32 Gigabytes of RAM. When we work with large datasets, if you assign a variable to a data type larger than the available RAM, it will not work. More on this later.

+

Look, now x can be reused downstream:

+
x - 2
+
## 37
+
y = x * 2
+

It is quite common for programmers to not know what data type a variable is while they are coding. To learn about the data type of a variable, use the type() function on any variable in Python:

+
type(y)
+
## <class 'int'>
+

We should give useful variable names so that we know what to expect! Consider num_sales instead of y.

+
+
+
+

1.7 Grammar Structure 3: Evaluation of Functions

+

Let’s look at functions a little bit more formally: A function has a function name, arguments, and returns a data type.

+
+

1.7.1 Execution rule for functions:

+
+

Evaluate the function by its arguments, and if the arguments are functions or contains operations, evaluate those functions or operations first.

+

The output of functions is called the returned value.

+
+

Often, we will use multiple functions, in a nested way, or use parenthesis to change the order of operation. Being able to read nested operations, nested functions, and parenthesis is very important. Think about what the Python is going to do step-by–step in the line of code below:

+
(len("hello") + 4) * 2
+
## 18
+

If we don’t know how to use a function, such as pow() we can ask for help:

+
?pow
+
+pow(base, exp, mod=None)
+Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments
+ 
+Some types, such as ints, are able to use a more efficient algorithm when
+invoked using the three argument form.
+

This shows the function takes in three input arguments: base, exp, and mod=None. When an argument has an assigned value of mod=None, that means the input argument already has a value, and you don’t need to specify anything, unless you want to.

+

The following ways are equivalent ways of using the pow() function:

+
pow(2, 3)
+
## 8
+
pow(base=2, exp=3)
+
## 8
+
pow(exp=3, base=2)
+
## 8
+

but this will give you something different:

+
pow(3, 2)
+
## 9
+

And there is an operational equivalent:

+
2 ** 3
+
## 8
+
+
+
+

1.8 Tips on writing your first code

+

Computer = powerful + stupid

+

Even the smallest spelling and formatting changes will cause unexpected output and errors!

+
    +
  • Write incrementally, test often

  • +
  • Check your assumptions, especially using new functions, operations, and new data types.

  • +
  • Live environments are great for testing, but not great for reproducibility.

  • +
  • Ask for help!

  • +
+

To get more familiar with the errors Python gives you, take a look at this summary of Python error messages.

+ +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+ + + + + + + + + + + + + diff --git a/docs/no_toc/introduction.html b/docs/no_toc/introduction.html deleted file mode 100644 index c1f3b2d..0000000 --- a/docs/no_toc/introduction.html +++ /dev/null @@ -1,413 +0,0 @@ - - - - - - - Chapter 1 Introduction | Course Name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
- - -
-
- -
- - - - - - - - - -
- -
-
-

Chapter 1 Introduction

-
-

1.1 Motivation

-
-
-

1.2 Target Audience

-

The course is intended for …

-
-
-

1.3 Curriculum

-

The course covers…

-
devtools::session_info()
-
## ─ Session info ───────────────────────────────────────────────────────────────
-##  setting  value
-##  version  R version 4.3.2 (2023-10-31)
-##  os       Ubuntu 22.04.4 LTS
-##  system   x86_64, linux-gnu
-##  ui       X11
-##  language (EN)
-##  collate  en_US.UTF-8
-##  ctype    en_US.UTF-8
-##  tz       Etc/UTC
-##  date     2024-08-06
-##  pandoc   3.1.1 @ /usr/local/bin/ (via rmarkdown)
-## 
-## ─ Packages ───────────────────────────────────────────────────────────────────
-##  package     * version date (UTC) lib source
-##  askpass       1.2.0   2023-09-03 [1] RSPM (R 4.3.0)
-##  bookdown      0.39.1  2024-06-11 [1] Github (rstudio/bookdown@f244cf1)
-##  bslib         0.6.1   2023-11-28 [1] RSPM (R 4.3.0)
-##  cachem        1.0.8   2023-05-01 [1] RSPM (R 4.3.0)
-##  cli           3.6.2   2023-12-11 [1] RSPM (R 4.3.0)
-##  devtools      2.4.5   2022-10-11 [1] RSPM (R 4.3.0)
-##  digest        0.6.34  2024-01-11 [1] RSPM (R 4.3.0)
-##  ellipsis      0.3.2   2021-04-29 [1] RSPM (R 4.3.0)
-##  evaluate      0.23    2023-11-01 [1] RSPM (R 4.3.0)
-##  fansi         1.0.6   2023-12-08 [1] RSPM (R 4.3.0)
-##  fastmap       1.1.1   2023-02-24 [1] RSPM (R 4.3.0)
-##  fs            1.6.3   2023-07-20 [1] RSPM (R 4.3.0)
-##  glue          1.7.0   2024-01-09 [1] RSPM (R 4.3.0)
-##  hms           1.1.3   2023-03-21 [1] RSPM (R 4.3.0)
-##  htmltools     0.5.7   2023-11-03 [1] RSPM (R 4.3.0)
-##  htmlwidgets   1.6.4   2023-12-06 [1] RSPM (R 4.3.0)
-##  httpuv        1.6.14  2024-01-26 [1] RSPM (R 4.3.0)
-##  httr          1.4.7   2023-08-15 [1] RSPM (R 4.3.0)
-##  jquerylib     0.1.4   2021-04-26 [1] RSPM (R 4.3.0)
-##  jsonlite      1.8.8   2023-12-04 [1] RSPM (R 4.3.0)
-##  knitr         1.47.3  2024-06-11 [1] Github (yihui/knitr@e1edd34)
-##  later         1.3.2   2023-12-06 [1] RSPM (R 4.3.0)
-##  lifecycle     1.0.4   2023-11-07 [1] RSPM (R 4.3.0)
-##  magrittr      2.0.3   2022-03-30 [1] RSPM (R 4.3.0)
-##  memoise       2.0.1   2021-11-26 [1] RSPM (R 4.3.0)
-##  mime          0.12    2021-09-28 [1] RSPM (R 4.3.0)
-##  miniUI        0.1.1.1 2018-05-18 [1] RSPM (R 4.3.0)
-##  openssl       2.1.1   2023-09-25 [1] RSPM (R 4.3.0)
-##  ottrpal       1.2.1   2024-06-11 [1] Github (jhudsl/ottrpal@828539f)
-##  pillar        1.9.0   2023-03-22 [1] RSPM (R 4.3.0)
-##  pkgbuild      1.4.3   2023-12-10 [1] RSPM (R 4.3.0)
-##  pkgconfig     2.0.3   2019-09-22 [1] RSPM (R 4.3.0)
-##  pkgload       1.3.4   2024-01-16 [1] RSPM (R 4.3.0)
-##  profvis       0.3.8   2023-05-02 [1] RSPM (R 4.3.0)
-##  promises      1.2.1   2023-08-10 [1] RSPM (R 4.3.0)
-##  purrr         1.0.2   2023-08-10 [1] RSPM (R 4.3.0)
-##  R6            2.5.1   2021-08-19 [1] RSPM (R 4.3.0)
-##  Rcpp          1.0.12  2024-01-09 [1] RSPM (R 4.3.0)
-##  readr         2.1.5   2024-01-10 [1] RSPM (R 4.3.0)
-##  remotes       2.4.2.1 2023-07-18 [1] RSPM (R 4.3.0)
-##  rlang         1.1.4   2024-06-04 [1] CRAN (R 4.3.2)
-##  rmarkdown     2.27.1  2024-06-11 [1] Github (rstudio/rmarkdown@e1c93a9)
-##  sass          0.4.8   2023-12-06 [1] RSPM (R 4.3.0)
-##  sessioninfo   1.2.2   2021-12-06 [1] RSPM (R 4.3.0)
-##  shiny         1.8.0   2023-11-17 [1] RSPM (R 4.3.0)
-##  stringi       1.8.3   2023-12-11 [1] RSPM (R 4.3.0)
-##  stringr       1.5.1   2023-11-14 [1] RSPM (R 4.3.0)
-##  tibble        3.2.1   2023-03-20 [1] CRAN (R 4.3.2)
-##  tzdb          0.4.0   2023-05-12 [1] RSPM (R 4.3.0)
-##  urlchecker    1.0.1   2021-11-30 [1] RSPM (R 4.3.0)
-##  usethis       2.2.3   2024-02-19 [1] RSPM (R 4.3.0)
-##  utf8          1.2.4   2023-10-22 [1] RSPM (R 4.3.0)
-##  vctrs         0.6.5   2023-12-01 [1] RSPM (R 4.3.0)
-##  xfun          0.44.4  2024-06-11 [1] Github (yihui/xfun@9da62cc)
-##  xml2          1.3.6   2023-12-04 [1] RSPM (R 4.3.0)
-##  xtable        1.8-4   2019-04-21 [1] RSPM (R 4.3.0)
-##  yaml          2.3.8   2023-12-11 [1] RSPM (R 4.3.0)
-## 
-##  [1] /usr/local/lib/R/site-library
-##  [2] /usr/local/lib/R/library
-## 
-## ──────────────────────────────────────────────────────────────────────────────
- -
-
-
-
- -
- -
- -
-
-
- - -
-
- - - - - - - - - - - - - diff --git a/docs/no_toc/reference-keys.txt b/docs/no_toc/reference-keys.txt index c785119..d172de4 100644 --- a/docs/no_toc/reference-keys.txt +++ b/docs/no_toc/reference-keys.txt @@ -1,27 +1,17 @@ -available-course-formats -introduction -motivation -target-audience curriculum -a-new-chapter +target-audience learning-objectives -libraries -topic-of-section -subtopic -code-examples -image-example -video-examples -using-knitr -using-html -using-knitr-1 -using-html-1 -website-examples -using-knitr-2 -using-html-2 -citation-examples -stylized-boxes -using-rmarkdown-container-syntax -using-html-3 -dropdown-summaries -print-out-session-info +offerings +intro-to-computing +goals-of-the-course +what-is-a-computer-program +a-programming-language-has-following-elements +google-colab-setup +grammar-structure-1-evaluation-of-expressions +data-types +grammar-structure-2-storing-data-types-in-the-variable-environment +execution-rule-for-variable-assignment +grammar-structure-3-evaluation-of-functions +execution-rule-for-functions +tips-on-writing-your-first-code references diff --git a/docs/no_toc/references.html b/docs/no_toc/references.html index 1fd91bd..d03090c 100644 --- a/docs/no_toc/references.html +++ b/docs/no_toc/references.html @@ -4,18 +4,18 @@ - Chapter 3 References | Course Name + Chapter 2 References | Introduction to Python - + - + @@ -82,67 +82,44 @@ } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode - { } + { background-color: #f8f8f8; } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } -code span.al { color: #ff0000; font-weight: bold; } /* Alert */ -code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ -code span.at { color: #7d9029; } /* Attribute */ -code span.bn { color: #40a070; } /* BaseN */ -code span.bu { color: #008000; } /* BuiltIn */ -code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ -code span.ch { color: #4070a0; } /* Char */ -code span.cn { color: #880000; } /* Constant */ -code span.co { color: #60a0b0; font-style: italic; } /* Comment */ -code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ -code span.do { color: #ba2121; font-style: italic; } /* Documentation */ -code span.dt { color: #902000; } /* DataType */ -code span.dv { color: #40a070; } /* DecVal */ -code span.er { color: #ff0000; font-weight: bold; } /* Error */ +code span.al { color: #ef2929; } /* Alert */ +code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */ +code span.at { color: #204a87; } /* Attribute */ +code span.bn { color: #0000cf; } /* BaseN */ +code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */ +code span.ch { color: #4e9a06; } /* Char */ +code span.cn { color: #8f5902; } /* Constant */ +code span.co { color: #8f5902; font-style: italic; } /* Comment */ +code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */ +code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */ +code span.dt { color: #204a87; } /* DataType */ +code span.dv { color: #0000cf; } /* DecVal */ +code span.er { color: #a40000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ -code span.fl { color: #40a070; } /* Float */ -code span.fu { color: #06287e; } /* Function */ -code span.im { color: #008000; font-weight: bold; } /* Import */ -code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ -code span.kw { color: #007020; font-weight: bold; } /* Keyword */ -code span.op { color: #666666; } /* Operator */ -code span.ot { color: #007020; } /* Other */ -code span.pp { color: #bc7a00; } /* Preprocessor */ -code span.sc { color: #4070a0; } /* SpecialChar */ -code span.ss { color: #bb6688; } /* SpecialString */ -code span.st { color: #4070a0; } /* String */ -code span.va { color: #19177c; } /* Variable */ -code span.vs { color: #4070a0; } /* VerbatimString */ -code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ +code span.fl { color: #0000cf; } /* Float */ +code span.fu { color: #204a87; font-weight: bold; } /* Function */ +code span.im { } /* Import */ +code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */ +code span.kw { color: #204a87; font-weight: bold; } /* Keyword */ +code span.op { color: #ce5c00; font-weight: bold; } /* Operator */ +code span.ot { color: #8f5902; } /* Other */ +code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */ +code span.sc { color: #ce5c00; font-weight: bold; } /* SpecialChar */ +code span.ss { color: #4e9a06; } /* SpecialString */ +code span.st { color: #4e9a06; } /* String */ +code span.va { color: #000000; } /* Variable */ +code span.vs { color: #4e9a06; } /* VerbatimString */ +code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */ - @@ -157,58 +134,43 @@ @@ -218,7 +180,7 @@
@@ -227,31 +189,20 @@

- + + - -
- +
+
-
-

Chapter 3 References

+
+

Chapter 2 References

-
-
-Allaire, JJ, Yihui Xie, Jonathan McPherson, Javier Luraschi, Kevin Ushey, Aron Atkins, Hadley Wickham, Joe Cheng, Winston Chang, and Richard Iannone. 2021. Rmarkdown: Dynamic Documents for r. https://github.com/rstudio/rmarkdown. -
-
-Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown. -
-
-Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook. -
-

@@ -259,17 +210,9 @@

Chapter 3 ReferencesCC-BY.
All other materials CC-BY unless noted otherwise. +

-

diff --git a/docs/no_toc/search_index.json b/docs/no_toc/search_index.json index 49b2d2f..aa8aa01 100644 --- a/docs/no_toc/search_index.json +++ b/docs/no_toc/search_index.json @@ -1 +1 @@ -[["index.html", "Course Name About this Course 0.1 Available course formats", " Course Name August, 2024 About this Course 0.1 Available course formats This course is available in multiple formats which allows you to take it in the way that best suites your needs. You can take it for certificate which can be for free or fee. The material for this course can be viewed without login requirement on this Bookdown website. This format might be most appropriate for you if you rely on screen-reader technology. This course can be taken for free certification through Leanpub. This course can be taken on Coursera for certification here (but it is not available for free on Coursera). Our courses are open source, you can find the source material for this course on GitHub. "],["introduction.html", "Chapter 1 Introduction 1.1 Motivation 1.2 Target Audience 1.3 Curriculum", " Chapter 1 Introduction 1.1 Motivation 1.2 Target Audience The course is intended for … 1.3 Curriculum The course covers… devtools::session_info() ## ─ Session info ─────────────────────────────────────────────────────────────── ## setting value ## version R version 4.3.2 (2023-10-31) ## os Ubuntu 22.04.4 LTS ## system x86_64, linux-gnu ## ui X11 ## language (EN) ## collate en_US.UTF-8 ## ctype en_US.UTF-8 ## tz Etc/UTC ## date 2024-08-06 ## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown) ## ## ─ Packages ─────────────────────────────────────────────────────────────────── ## package * version date (UTC) lib source ## askpass 1.2.0 2023-09-03 [1] RSPM (R 4.3.0) ## bookdown 0.39.1 2024-06-11 [1] Github (rstudio/bookdown@f244cf1) ## bslib 0.6.1 2023-11-28 [1] RSPM (R 4.3.0) ## cachem 1.0.8 2023-05-01 [1] RSPM (R 4.3.0) ## cli 3.6.2 2023-12-11 [1] RSPM (R 4.3.0) ## devtools 2.4.5 2022-10-11 [1] RSPM (R 4.3.0) ## digest 0.6.34 2024-01-11 [1] RSPM (R 4.3.0) ## ellipsis 0.3.2 2021-04-29 [1] RSPM (R 4.3.0) ## evaluate 0.23 2023-11-01 [1] RSPM (R 4.3.0) ## fansi 1.0.6 2023-12-08 [1] RSPM (R 4.3.0) ## fastmap 1.1.1 2023-02-24 [1] RSPM (R 4.3.0) ## fs 1.6.3 2023-07-20 [1] RSPM (R 4.3.0) ## glue 1.7.0 2024-01-09 [1] RSPM (R 4.3.0) ## hms 1.1.3 2023-03-21 [1] RSPM (R 4.3.0) ## htmltools 0.5.7 2023-11-03 [1] RSPM (R 4.3.0) ## htmlwidgets 1.6.4 2023-12-06 [1] RSPM (R 4.3.0) ## httpuv 1.6.14 2024-01-26 [1] RSPM (R 4.3.0) ## httr 1.4.7 2023-08-15 [1] RSPM (R 4.3.0) ## jquerylib 0.1.4 2021-04-26 [1] RSPM (R 4.3.0) ## jsonlite 1.8.8 2023-12-04 [1] RSPM (R 4.3.0) ## knitr 1.47.3 2024-06-11 [1] Github (yihui/knitr@e1edd34) ## later 1.3.2 2023-12-06 [1] RSPM (R 4.3.0) ## lifecycle 1.0.4 2023-11-07 [1] RSPM (R 4.3.0) ## magrittr 2.0.3 2022-03-30 [1] RSPM (R 4.3.0) ## memoise 2.0.1 2021-11-26 [1] RSPM (R 4.3.0) ## mime 0.12 2021-09-28 [1] RSPM (R 4.3.0) ## miniUI 0.1.1.1 2018-05-18 [1] RSPM (R 4.3.0) ## openssl 2.1.1 2023-09-25 [1] RSPM (R 4.3.0) ## ottrpal 1.2.1 2024-06-11 [1] Github (jhudsl/ottrpal@828539f) ## pillar 1.9.0 2023-03-22 [1] RSPM (R 4.3.0) ## pkgbuild 1.4.3 2023-12-10 [1] RSPM (R 4.3.0) ## pkgconfig 2.0.3 2019-09-22 [1] RSPM (R 4.3.0) ## pkgload 1.3.4 2024-01-16 [1] RSPM (R 4.3.0) ## profvis 0.3.8 2023-05-02 [1] RSPM (R 4.3.0) ## promises 1.2.1 2023-08-10 [1] RSPM (R 4.3.0) ## purrr 1.0.2 2023-08-10 [1] RSPM (R 4.3.0) ## R6 2.5.1 2021-08-19 [1] RSPM (R 4.3.0) ## Rcpp 1.0.12 2024-01-09 [1] RSPM (R 4.3.0) ## readr 2.1.5 2024-01-10 [1] RSPM (R 4.3.0) ## remotes 2.4.2.1 2023-07-18 [1] RSPM (R 4.3.0) ## rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.2) ## rmarkdown 2.27.1 2024-06-11 [1] Github (rstudio/rmarkdown@e1c93a9) ## sass 0.4.8 2023-12-06 [1] RSPM (R 4.3.0) ## sessioninfo 1.2.2 2021-12-06 [1] RSPM (R 4.3.0) ## shiny 1.8.0 2023-11-17 [1] RSPM (R 4.3.0) ## stringi 1.8.3 2023-12-11 [1] RSPM (R 4.3.0) ## stringr 1.5.1 2023-11-14 [1] RSPM (R 4.3.0) ## tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.2) ## tzdb 0.4.0 2023-05-12 [1] RSPM (R 4.3.0) ## urlchecker 1.0.1 2021-11-30 [1] RSPM (R 4.3.0) ## usethis 2.2.3 2024-02-19 [1] RSPM (R 4.3.0) ## utf8 1.2.4 2023-10-22 [1] RSPM (R 4.3.0) ## vctrs 0.6.5 2023-12-01 [1] RSPM (R 4.3.0) ## xfun 0.44.4 2024-06-11 [1] Github (yihui/xfun@9da62cc) ## xml2 1.3.6 2023-12-04 [1] RSPM (R 4.3.0) ## xtable 1.8-4 2019-04-21 [1] RSPM (R 4.3.0) ## yaml 2.3.8 2023-12-11 [1] RSPM (R 4.3.0) ## ## [1] /usr/local/lib/R/site-library ## [2] /usr/local/lib/R/library ## ## ────────────────────────────────────────────────────────────────────────────── "],["a-new-chapter.html", "Chapter 2 A new chapter 2.1 Learning Objectives 2.2 Libraries 2.3 Topic of Section 2.4 Code examples 2.5 Image example 2.6 Video examples 2.7 Website Examples 2.8 Citation examples 2.9 Stylized boxes 2.10 Dropdown summaries 2.11 Print out session info", " Chapter 2 A new chapter If you haven’t yet read the getting started Wiki pages; start there. To see the rendered version of this chapter and the rest of the template, see here: https://jhudatascience.org/OTTR_Template/. Every chapter needs to start out with this chunk of code: 2.1 Learning Objectives Every chapter also needs Learning objectives that will look like this: This chapter will cover: {You can use https://tips.uark.edu/using-blooms-taxonomy/ to define some learning objectives here} {Another learning objective} 2.2 Libraries For this chapter, we’ll need the following packages attached: *Remember to add any additional packages you need to your course’s own docker image. library(magrittr) 2.3 Topic of Section You can write all your text in sections like this, using ## to indicate a new header. you can use additional pound symbols to create lower levels of headers. See here for additional general information about how you can format text within R Markdown files. In addition, see here for more in depth and advanced options. 2.3.1 Subtopic Here’s a subheading (using three pound symbols) and some text in this subsection! 2.4 Code examples You can demonstrate code like this: output_dir <- file.path("resources", "code_output") if (!dir.exists(output_dir)) { dir.create(output_dir) } And make plots too: hist_plot <- hist(iris$Sepal.Length) You can also save these plots to file: png(file.path(output_dir, "test_plot.png")) hist_plot ## $breaks ## [1] 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 ## ## $counts ## [1] 5 27 27 30 31 18 6 6 ## ## $density ## [1] 0.06666667 0.36000000 0.36000000 0.40000000 0.41333333 0.24000000 0.08000000 ## [8] 0.08000000 ## ## $mids ## [1] 4.25 4.75 5.25 5.75 6.25 6.75 7.25 7.75 ## ## $xname ## [1] "iris$Sepal.Length" ## ## $equidist ## [1] TRUE ## ## attr(,"class") ## [1] "histogram" dev.off() ## png ## 2 2.5 Image example How to include a Google slide. It’s simplest to use the ottrpal package: But if you have the slide or some other image locally downloaded you can also use HTML like this: 2.6 Video examples You may also want to embed videos in your course. If alternatively, you just want to include a link you can do so like this: Check out this link to a video using markdown syntax. 2.6.1 Using knitr To embed videos in your course, you can use knitr::include_url() like this: Note that you should use echo=FALSE in the code chunk because we don’t want the code part of this to show up. If you are unfamiliar with how R Markdown code chunks work, read this. 2.6.2 Using HTML 2.6.3 Using knitr 2.6.4 Using HTML 2.7 Website Examples Yet again you can use a link to a website like so: A Website You might want to have users open a website in a new tab by default, especially if they need to reference both the course and a resource at once. A Website Or, you can embed some websites. 2.7.1 Using knitr This works: 2.7.2 Using HTML If you’d like the URL to show up in a new tab you can do this: <a href="https://www.linkedin.com" target="_blank">LinkedIn</a> 2.8 Citation examples We can put citations at the end of a sentence like this (Allaire et al. 2021). Or multiple citations Xie, Allaire, and Grolemund (2018). but they need a ; separator (Allaire et al. 2021; Xie, Allaire, and Grolemund 2018). In text, we can put citations like this Allaire et al. (2021). 2.9 Stylized boxes Occasionally, you might find it useful to emphasize a particular piece of information. To help you do so, we have provided css code and images (no need for you to worry about that!) to create the following stylized boxes. You can use these boxes in your course with either of two options: using HTML code or Pandoc syntax. 2.9.1 Using rmarkdown container syntax The rmarkdown package allows for a different syntax to be converted to the HTML that you just saw and also allows for conversion to LaTeX. See the Bookdown documentation for more information (Xie, Dervieux, and Riederer 2020). Note that Bookdown uses Pandoc. ::: {.notice} Note using rmarkdown syntax. ::: Note using rmarkdown syntax. As an example you might do something like this: Please click on the subsection headers in the left hand navigation bar (e.g., 2.1, 4.3) a second time to expand the table of contents and enable the scroll_highlight feature (see more) 2.9.2 Using HTML To add a warning box like the following use: <div class = "notice"> Followed by the text you want inside </div> This will create the following: Followed by the text you want inside Here is a <div class = \"warning\"> box: Note text Here is a <div class = \"github\"> box: GitHub text Here is a <div class = \"dictionary\"> box: dictionary text Here is a <div class = \"reflection\"> box: reflection text Here is a <div class = \"wip\"> box: Work in Progress text 2.10 Dropdown summaries You can hide additional information in a dropdown menu Here’s more words that are hidden. 2.11 Print out session info You should print out session info when you have code for reproducibility purposes. devtools::session_info() ## ─ Session info ─────────────────────────────────────────────────────────────── ## setting value ## version R version 4.3.2 (2023-10-31) ## os Ubuntu 22.04.4 LTS ## system x86_64, linux-gnu ## ui X11 ## language (EN) ## collate en_US.UTF-8 ## ctype en_US.UTF-8 ## tz Etc/UTC ## date 2024-08-06 ## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown) ## ## ─ Packages ─────────────────────────────────────────────────────────────────── ## package * version date (UTC) lib source ## askpass 1.2.0 2023-09-03 [1] RSPM (R 4.3.0) ## bookdown 0.39.1 2024-06-11 [1] Github (rstudio/bookdown@f244cf1) ## bslib 0.6.1 2023-11-28 [1] RSPM (R 4.3.0) ## cachem 1.0.8 2023-05-01 [1] RSPM (R 4.3.0) ## cli 3.6.2 2023-12-11 [1] RSPM (R 4.3.0) ## curl 5.2.0 2023-12-08 [1] RSPM (R 4.3.0) ## devtools 2.4.5 2022-10-11 [1] RSPM (R 4.3.0) ## digest 0.6.34 2024-01-11 [1] RSPM (R 4.3.0) ## ellipsis 0.3.2 2021-04-29 [1] RSPM (R 4.3.0) ## evaluate 0.23 2023-11-01 [1] RSPM (R 4.3.0) ## fansi 1.0.6 2023-12-08 [1] RSPM (R 4.3.0) ## fastmap 1.1.1 2023-02-24 [1] RSPM (R 4.3.0) ## fs 1.6.3 2023-07-20 [1] RSPM (R 4.3.0) ## glue 1.7.0 2024-01-09 [1] RSPM (R 4.3.0) ## highr 0.10 2022-12-22 [1] RSPM (R 4.3.0) ## hms 1.1.3 2023-03-21 [1] RSPM (R 4.3.0) ## htmltools 0.5.7 2023-11-03 [1] RSPM (R 4.3.0) ## htmlwidgets 1.6.4 2023-12-06 [1] RSPM (R 4.3.0) ## httpuv 1.6.14 2024-01-26 [1] RSPM (R 4.3.0) ## httr 1.4.7 2023-08-15 [1] RSPM (R 4.3.0) ## jquerylib 0.1.4 2021-04-26 [1] RSPM (R 4.3.0) ## jsonlite 1.8.8 2023-12-04 [1] RSPM (R 4.3.0) ## knitr 1.47.3 2024-06-11 [1] Github (yihui/knitr@e1edd34) ## later 1.3.2 2023-12-06 [1] RSPM (R 4.3.0) ## lifecycle 1.0.4 2023-11-07 [1] RSPM (R 4.3.0) ## magrittr * 2.0.3 2022-03-30 [1] RSPM (R 4.3.0) ## memoise 2.0.1 2021-11-26 [1] RSPM (R 4.3.0) ## mime 0.12 2021-09-28 [1] RSPM (R 4.3.0) ## miniUI 0.1.1.1 2018-05-18 [1] RSPM (R 4.3.0) ## openssl 2.1.1 2023-09-25 [1] RSPM (R 4.3.0) ## ottrpal 1.2.1 2024-06-11 [1] Github (jhudsl/ottrpal@828539f) ## pillar 1.9.0 2023-03-22 [1] RSPM (R 4.3.0) ## pkgbuild 1.4.3 2023-12-10 [1] RSPM (R 4.3.0) ## pkgconfig 2.0.3 2019-09-22 [1] RSPM (R 4.3.0) ## pkgload 1.3.4 2024-01-16 [1] RSPM (R 4.3.0) ## profvis 0.3.8 2023-05-02 [1] RSPM (R 4.3.0) ## promises 1.2.1 2023-08-10 [1] RSPM (R 4.3.0) ## purrr 1.0.2 2023-08-10 [1] RSPM (R 4.3.0) ## R6 2.5.1 2021-08-19 [1] RSPM (R 4.3.0) ## Rcpp 1.0.12 2024-01-09 [1] RSPM (R 4.3.0) ## readr 2.1.5 2024-01-10 [1] RSPM (R 4.3.0) ## remotes 2.4.2.1 2023-07-18 [1] RSPM (R 4.3.0) ## rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.2) ## rmarkdown 2.27.1 2024-06-11 [1] Github (rstudio/rmarkdown@e1c93a9) ## sass 0.4.8 2023-12-06 [1] RSPM (R 4.3.0) ## sessioninfo 1.2.2 2021-12-06 [1] RSPM (R 4.3.0) ## shiny 1.8.0 2023-11-17 [1] RSPM (R 4.3.0) ## stringi 1.8.3 2023-12-11 [1] RSPM (R 4.3.0) ## stringr 1.5.1 2023-11-14 [1] RSPM (R 4.3.0) ## tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.2) ## tzdb 0.4.0 2023-05-12 [1] RSPM (R 4.3.0) ## urlchecker 1.0.1 2021-11-30 [1] RSPM (R 4.3.0) ## usethis 2.2.3 2024-02-19 [1] RSPM (R 4.3.0) ## utf8 1.2.4 2023-10-22 [1] RSPM (R 4.3.0) ## vctrs 0.6.5 2023-12-01 [1] RSPM (R 4.3.0) ## xfun 0.44.4 2024-06-11 [1] Github (yihui/xfun@9da62cc) ## xml2 1.3.6 2023-12-04 [1] RSPM (R 4.3.0) ## xtable 1.8-4 2019-04-21 [1] RSPM (R 4.3.0) ## yaml 2.3.8 2023-12-11 [1] RSPM (R 4.3.0) ## ## [1] /usr/local/lib/R/site-library ## [2] /usr/local/lib/R/library ## ## ────────────────────────────────────────────────────────────────────────────── References "],["about-the-authors.html", "About the Authors", " About the Authors These credits are based on our course contributors table guidelines.     Credits Names Pedagogy Lead Content Instructor(s) FirstName LastName Lecturer(s) (include chapter name/link in parentheses if only for specific chapters) - make new line if more than one chapter involved Delivered the course in some way - video or audio Content Author(s) (include chapter name/link in parentheses if only for specific chapters) - make new line if more than one chapter involved If any other authors besides lead instructor Content Contributor(s) (include section name/link in parentheses) - make new line if more than one section involved Wrote less than a chapter Content Editor(s)/Reviewer(s) Checked your content Content Director(s) Helped guide the content direction Content Consultants (include chapter name/link in parentheses or word “General”) - make new line if more than one chapter involved Gave high level advice on content Acknowledgments Gave small assistance to content but not to the level of consulting Production Content Publisher(s) Helped with publishing platform Content Publishing Reviewer(s) Reviewed overall content and aesthetics on publishing platform Technical Course Publishing Engineer(s) Helped with the code for the technical aspects related to the specific course generation Template Publishing Engineers Candace Savonen, Carrie Wright, Ava Hoffman Publishing Maintenance Engineer Candace Savonen Technical Publishing Stylists Carrie Wright, Ava Hoffman, Candace Savonen Package Developers (ottrpal) Candace Savonen, John Muschelli, Carrie Wright Art and Design Illustrator(s) Created graphics for the course Figure Artist(s) Created figures/plots for course Videographer(s) Filmed videos Videography Editor(s) Edited film Audiographer(s) Recorded audio Audiography Editor(s) Edited audio recordings Funding Funder(s) Institution/individual who funded course including grant number Funding Staff Staff members who help with funding   ## ─ Session info ─────────────────────────────────────────────────────────────── ## setting value ## version R version 4.3.2 (2023-10-31) ## os Ubuntu 22.04.4 LTS ## system x86_64, linux-gnu ## ui X11 ## language (EN) ## collate en_US.UTF-8 ## ctype en_US.UTF-8 ## tz Etc/UTC ## date 2024-08-06 ## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown) ## ## ─ Packages ─────────────────────────────────────────────────────────────────── ## package * version date (UTC) lib source ## askpass 1.2.0 2023-09-03 [1] RSPM (R 4.3.0) ## bookdown 0.39.1 2024-06-11 [1] Github (rstudio/bookdown@f244cf1) ## bslib 0.6.1 2023-11-28 [1] RSPM (R 4.3.0) ## cachem 1.0.8 2023-05-01 [1] RSPM (R 4.3.0) ## cli 3.6.2 2023-12-11 [1] RSPM (R 4.3.0) ## devtools 2.4.5 2022-10-11 [1] RSPM (R 4.3.0) ## digest 0.6.34 2024-01-11 [1] RSPM (R 4.3.0) ## ellipsis 0.3.2 2021-04-29 [1] RSPM (R 4.3.0) ## evaluate 0.23 2023-11-01 [1] RSPM (R 4.3.0) ## fansi 1.0.6 2023-12-08 [1] RSPM (R 4.3.0) ## fastmap 1.1.1 2023-02-24 [1] RSPM (R 4.3.0) ## fs 1.6.3 2023-07-20 [1] RSPM (R 4.3.0) ## glue 1.7.0 2024-01-09 [1] RSPM (R 4.3.0) ## hms 1.1.3 2023-03-21 [1] RSPM (R 4.3.0) ## htmltools 0.5.7 2023-11-03 [1] RSPM (R 4.3.0) ## htmlwidgets 1.6.4 2023-12-06 [1] RSPM (R 4.3.0) ## httpuv 1.6.14 2024-01-26 [1] RSPM (R 4.3.0) ## httr 1.4.7 2023-08-15 [1] RSPM (R 4.3.0) ## jquerylib 0.1.4 2021-04-26 [1] RSPM (R 4.3.0) ## jsonlite 1.8.8 2023-12-04 [1] RSPM (R 4.3.0) ## knitr 1.47.3 2024-06-11 [1] Github (yihui/knitr@e1edd34) ## later 1.3.2 2023-12-06 [1] RSPM (R 4.3.0) ## lifecycle 1.0.4 2023-11-07 [1] RSPM (R 4.3.0) ## magrittr 2.0.3 2022-03-30 [1] RSPM (R 4.3.0) ## memoise 2.0.1 2021-11-26 [1] RSPM (R 4.3.0) ## mime 0.12 2021-09-28 [1] RSPM (R 4.3.0) ## miniUI 0.1.1.1 2018-05-18 [1] RSPM (R 4.3.0) ## openssl 2.1.1 2023-09-25 [1] RSPM (R 4.3.0) ## ottrpal 1.2.1 2024-06-11 [1] Github (jhudsl/ottrpal@828539f) ## pillar 1.9.0 2023-03-22 [1] RSPM (R 4.3.0) ## pkgbuild 1.4.3 2023-12-10 [1] RSPM (R 4.3.0) ## pkgconfig 2.0.3 2019-09-22 [1] RSPM (R 4.3.0) ## pkgload 1.3.4 2024-01-16 [1] RSPM (R 4.3.0) ## profvis 0.3.8 2023-05-02 [1] RSPM (R 4.3.0) ## promises 1.2.1 2023-08-10 [1] RSPM (R 4.3.0) ## purrr 1.0.2 2023-08-10 [1] RSPM (R 4.3.0) ## R6 2.5.1 2021-08-19 [1] RSPM (R 4.3.0) ## Rcpp 1.0.12 2024-01-09 [1] RSPM (R 4.3.0) ## readr 2.1.5 2024-01-10 [1] RSPM (R 4.3.0) ## remotes 2.4.2.1 2023-07-18 [1] RSPM (R 4.3.0) ## rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.2) ## rmarkdown 2.27.1 2024-06-11 [1] Github (rstudio/rmarkdown@e1c93a9) ## sass 0.4.8 2023-12-06 [1] RSPM (R 4.3.0) ## sessioninfo 1.2.2 2021-12-06 [1] RSPM (R 4.3.0) ## shiny 1.8.0 2023-11-17 [1] RSPM (R 4.3.0) ## stringi 1.8.3 2023-12-11 [1] RSPM (R 4.3.0) ## stringr 1.5.1 2023-11-14 [1] RSPM (R 4.3.0) ## tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.2) ## tzdb 0.4.0 2023-05-12 [1] RSPM (R 4.3.0) ## urlchecker 1.0.1 2021-11-30 [1] RSPM (R 4.3.0) ## usethis 2.2.3 2024-02-19 [1] RSPM (R 4.3.0) ## utf8 1.2.4 2023-10-22 [1] RSPM (R 4.3.0) ## vctrs 0.6.5 2023-12-01 [1] RSPM (R 4.3.0) ## xfun 0.44.4 2024-06-11 [1] Github (yihui/xfun@9da62cc) ## xml2 1.3.6 2023-12-04 [1] RSPM (R 4.3.0) ## xtable 1.8-4 2019-04-21 [1] RSPM (R 4.3.0) ## yaml 2.3.8 2023-12-11 [1] RSPM (R 4.3.0) ## ## [1] /usr/local/lib/R/site-library ## [2] /usr/local/lib/R/library ## ## ────────────────────────────────────────────────────────────────────────────── "],["references.html", "Chapter 3 References", " Chapter 3 References "],["404.html", "Page not found", " Page not found The page you requested cannot be found (perhaps it was moved or renamed). You may want to try searching to find the page's new location, or use the table of contents to find the page you are looking for. "]] +[["index.html", "Introduction to Python About this Course 0.1 Curriculum 0.2 Target Audience 0.3 Learning Objectives 0.4 Offerings", " Introduction to Python August, 2024 About this Course 0.1 Curriculum The course covers fundamentals of Python, a high-level programming language, and use it to wrangle data for analysis and visualization. 0.2 Target Audience The course is intended for researchers who want to learn coding for the first time with a data science application via the Python language. This course is also appropriate for folks who have explored data science or programming on their own and want to focus on some fundamentals. 0.3 Learning Objectives Analyze Tidy datasets in the Python programming language via data subsetting, joining, and transformations. Evaluate summary statistics and data visualization to understand scientific questions. Describe how the Python programming environment interpret complex expressions made out of functions, operations, and data structures, in a step-by-step way. Apply problem solving strategies to debug broken code. 0.4 Offerings This course is taught on a regular basis at Fred Hutch Cancer Center through the Data Science Lab. Announcements of course offering can be found here. "],["intro-to-computing.html", "Chapter 1 Intro to Computing 1.1 Goals of the course 1.2 What is a computer program? 1.3 A programming language has following elements: 1.4 Google Colab Setup 1.5 Grammar Structure 1: Evaluation of Expressions 1.6 Grammar Structure 2: Storing data types in the Variable Environment 1.7 Grammar Structure 3: Evaluation of Functions 1.8 Tips on writing your first code", " Chapter 1 Intro to Computing Welcome to Introduction to Python! Each week, we cover a chapter, which consists of a lesson and exercise. In our first week together, we will look at big conceptual themes in programming, see how code is run, and learn some basic grammar structures of programming. 1.1 Goals of the course In the next 6 weeks, we will explore: Fundamental concepts in high-level programming languages (Python, R, Julia, etc.) that is transferable: How do programs run, and how do we solve problems using functions and data structures? Beginning of data science fundamentals: How do you translate your scientific question to a data wrangling problem and answer it? Data science workflow. Image source: R for Data Science. Find a nice balance between the two throughout the course: we will try to reproduce a figure from a scientific publication using new data. 1.2 What is a computer program? A sequence of instructions to manipulate data for the computer to execute. A series of translations: English <-> Programming Code for Interpreter <-> Machine Code for Central Processing Unit (CPU) We will focus on English <-> Programming Code for Python Interpreter in this class. More importantly: How we organize ideas <-> Instructing a computer to do something. 1.3 A programming language has following elements: Grammar structure to construct expressions; combining expressions to create more complex expressions Encapsulate complex expressions via functions to create modular and reusable tasks Encapsulate complex data via data structures to allow efficient manipulation of data 1.4 Google Colab Setup Google Colab is a Integrated Development Environment (IDE) on a web browser. Think about it as Microsoft Word to a plain text editor. It provides extra bells and whistles to using Python that is easier for the user. Let’s open up the KRAS analysis in Google Colab. If you are taking this course while it is in session, the project name is probably named “KRAS Demo” in your Google Classroom workspace. If you are taking this course on your own time, open up… Today, we will pay close attention to: Python Console (Execution): Open it via View -> Executed code history. You give it one line of Python code, and the console executes that single line of code; you give it a single piece of instruction, and it executes it for you. Notebook: in the central panel of the website, you will see Python code interspersed with word document text. This is called a Python Notebook (other similar services include Jupyter Notebook, iPython Notebook), which has chunks of plain text and Python code, and it helps us understand better the code we are writing. Variable Environment: Open it by clicking on the “{x}” button on the left-hand panel. Often, your code will store information in the Variable Environment, so that information can be reused. For instance, we often load in data and store it in the Variable Environment, and use it throughout rest of your Python code. The first thing we will do is see the different ways we can run Python code. You can do the following: Type something into the Python Console (Execution) and type enter, such as 2+2. The Python Console will run it and give you an output. Look through the Python Notebook, and when you see a chunk of Python Code, click the arrow button. It will copy the Python code chunk to the Python Console and run all of it. You will likely see variables created in the Variables panel as you load in and manipulate data. Run every single Python code chunk via Runtime -> Run all. Remember that the order that you run your code matters in programming. Your final product would be the result of Option 3, in which you run every Python code chunk from start to finish. However, sometimes it is nice to try out smaller parts of your code via Options 1 or 2. But you will be at risk of running your code out of order! To create your own content in the notebook, click on a section you want to insert content, and then click on “+ Code” or “+ Text” to add Python code or text, respectively. Python Notebook is great for data science work, because: It encourages reproducible data analysis, when you run your analysis from start to finish. It encourages excellent documentation, as you can have code, output from code, and prose combined together. It is flexible to use other programming languages, such as R. Now, we will get to the basics of programming grammar. 1.5 Grammar Structure 1: Evaluation of Expressions Expressions are be built out of operations or functions. Functions and operations take in data types, do something with them, and return another data type. We can combine multiple expressions together to form more complex expressions: an expression can have other expressions nested inside it. For instance, consider the following expressions entered to the Python Console: 18 + 21 ## 39 max(18, 21) ## 21 max(18 + 21, 65) ## 65 18 + (21 + 65) ## 104 len("ATCG") ## 4 Here, our input data types to the operation are integer in lines 1-4 and our input data type to the function is string in line 5. We will go over common data types shortly. Operations are just functions in hiding. We could have written: from operator import add add(18, 21) ## 39 add(18, add(21, 65)) ## 104 Remember that the Python language is supposed to help us understand what we are writing in code easily, lending to readable code. Therefore, it is sometimes useful to come up with operations that is easier to read. (Because the add() function isn’t typically used, it is not automatically available, so we used the import statement to load it in.) 1.5.1 Data types Here are some common data types we will be using in this course. Data type name Data type shorthand Examples Integer int 2, 4 Float float 3.5, -34.1009 String str “hello”, “234-234-8594” Boolean bool True, False A nice way to summarize this first grammar structure is using the function machine schema, way back from algebra class: Function machine from algebra class. Here are some aspects of this schema to pay attention to: A programmer should not need to know how the function is implemented in order to use it - this emphasizes abstraction and modular thinking, a foundation in any programming language. A function can have different kinds of inputs and outputs - it doesn’t need to be numbers. In the len() function, the input is a String, and the output is an Integer. We will see increasingly complex functions with all sorts of different inputs and outputs. 1.6 Grammar Structure 2: Storing data types in the Variable Environment To build up a computer program, we need to store our returned data type from our expression somewhere for downstream use. We can assign a variable to it as follows: x = 18 + 21 If you enter this in the Console, you will see that in the Variable Environment, the variable x has a value of 39. 1.6.1 Execution rule for variable assignment Evaluate the expression to the right of =. Bind variable to the left of = to the resulting value. The variable is stored in the Variable Environment. The Variable Environment is where all the variables are stored, and can be used for an expression anytime once it is defined. Only one unique variable name can be defined. The variable is stored in the working memory of your computer, Random Access Memory (RAM). This is temporary memory storage on the computer that can be accessed quickly. Typically a personal computer has 8, 16, 32 Gigabytes of RAM. When we work with large datasets, if you assign a variable to a data type larger than the available RAM, it will not work. More on this later. Look, now x can be reused downstream: x - 2 ## 37 y = x * 2 It is quite common for programmers to not know what data type a variable is while they are coding. To learn about the data type of a variable, use the type() function on any variable in Python: type(y) ## <class 'int'> We should give useful variable names so that we know what to expect! Consider num_sales instead of y. 1.7 Grammar Structure 3: Evaluation of Functions Let’s look at functions a little bit more formally: A function has a function name, arguments, and returns a data type. 1.7.1 Execution rule for functions: Evaluate the function by its arguments, and if the arguments are functions or contains operations, evaluate those functions or operations first. The output of functions is called the returned value. Often, we will use multiple functions, in a nested way, or use parenthesis to change the order of operation. Being able to read nested operations, nested functions, and parenthesis is very important. Think about what the Python is going to do step-by–step in the line of code below: (len("hello") + 4) * 2 ## 18 If we don’t know how to use a function, such as pow() we can ask for help: ?pow pow(base, exp, mod=None) Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments Some types, such as ints, are able to use a more efficient algorithm when invoked using the three argument form. This shows the function takes in three input arguments: base, exp, and mod=None. When an argument has an assigned value of mod=None, that means the input argument already has a value, and you don’t need to specify anything, unless you want to. The following ways are equivalent ways of using the pow() function: pow(2, 3) ## 8 pow(base=2, exp=3) ## 8 pow(exp=3, base=2) ## 8 but this will give you something different: pow(3, 2) ## 9 And there is an operational equivalent: 2 ** 3 ## 8 1.8 Tips on writing your first code Computer = powerful + stupid Even the smallest spelling and formatting changes will cause unexpected output and errors! Write incrementally, test often Check your assumptions, especially using new functions, operations, and new data types. Live environments are great for testing, but not great for reproducibility. Ask for help! To get more familiar with the errors Python gives you, take a look at this summary of Python error messages. "],["about-the-authors.html", "About the Authors", " About the Authors These credits are based on our course contributors table guidelines.     Credits Names Pedagogy Lead Content Instructor(s) FirstName LastName Lecturer(s) (include chapter name/link in parentheses if only for specific chapters) - make new line if more than one chapter involved Delivered the course in some way - video or audio Content Author(s) (include chapter name/link in parentheses if only for specific chapters) - make new line if more than one chapter involved If any other authors besides lead instructor Content Contributor(s) (include section name/link in parentheses) - make new line if more than one section involved Wrote less than a chapter Content Editor(s)/Reviewer(s) Checked your content Content Director(s) Helped guide the content direction Content Consultants (include chapter name/link in parentheses or word “General”) - make new line if more than one chapter involved Gave high level advice on content Acknowledgments Gave small assistance to content but not to the level of consulting Production Content Publisher(s) Helped with publishing platform Content Publishing Reviewer(s) Reviewed overall content and aesthetics on publishing platform Technical Course Publishing Engineer(s) Helped with the code for the technical aspects related to the specific course generation Template Publishing Engineers Candace Savonen, Carrie Wright, Ava Hoffman Publishing Maintenance Engineer Candace Savonen Technical Publishing Stylists Carrie Wright, Ava Hoffman, Candace Savonen Package Developers (ottrpal) Candace Savonen, John Muschelli, Carrie Wright Art and Design Illustrator(s) Created graphics for the course Figure Artist(s) Created figures/plots for course Videographer(s) Filmed videos Videography Editor(s) Edited film Audiographer(s) Recorded audio Audiography Editor(s) Edited audio recordings Funding Funder(s) Institution/individual who funded course including grant number Funding Staff Staff members who help with funding   ## ─ Session info ─────────────────────────────────────────────────────────────── ## setting value ## version R version 4.3.2 (2023-10-31) ## os Ubuntu 22.04.4 LTS ## system x86_64, linux-gnu ## ui X11 ## language (EN) ## collate en_US.UTF-8 ## ctype en_US.UTF-8 ## tz Etc/UTC ## date 2024-08-07 ## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown) ## ## ─ Packages ─────────────────────────────────────────────────────────────────── ## package * version date (UTC) lib source ## askpass 1.2.0 2023-09-03 [1] RSPM (R 4.3.0) ## bookdown 0.39.1 2024-06-11 [1] Github (rstudio/bookdown@f244cf1) ## bslib 0.6.1 2023-11-28 [1] RSPM (R 4.3.0) ## cachem 1.0.8 2023-05-01 [1] RSPM (R 4.3.0) ## cli 3.6.2 2023-12-11 [1] RSPM (R 4.3.0) ## devtools 2.4.5 2022-10-11 [1] RSPM (R 4.3.0) ## digest 0.6.34 2024-01-11 [1] RSPM (R 4.3.0) ## ellipsis 0.3.2 2021-04-29 [1] RSPM (R 4.3.0) ## evaluate 0.23 2023-11-01 [1] RSPM (R 4.3.0) ## fansi 1.0.6 2023-12-08 [1] RSPM (R 4.3.0) ## fastmap 1.1.1 2023-02-24 [1] RSPM (R 4.3.0) ## fs 1.6.3 2023-07-20 [1] RSPM (R 4.3.0) ## glue 1.7.0 2024-01-09 [1] RSPM (R 4.3.0) ## hms 1.1.3 2023-03-21 [1] RSPM (R 4.3.0) ## htmltools 0.5.7 2023-11-03 [1] RSPM (R 4.3.0) ## htmlwidgets 1.6.4 2023-12-06 [1] RSPM (R 4.3.0) ## httpuv 1.6.14 2024-01-26 [1] RSPM (R 4.3.0) ## httr 1.4.7 2023-08-15 [1] RSPM (R 4.3.0) ## jquerylib 0.1.4 2021-04-26 [1] RSPM (R 4.3.0) ## jsonlite 1.8.8 2023-12-04 [1] RSPM (R 4.3.0) ## knitr 1.47.3 2024-06-11 [1] Github (yihui/knitr@e1edd34) ## later 1.3.2 2023-12-06 [1] RSPM (R 4.3.0) ## lifecycle 1.0.4 2023-11-07 [1] RSPM (R 4.3.0) ## magrittr 2.0.3 2022-03-30 [1] RSPM (R 4.3.0) ## memoise 2.0.1 2021-11-26 [1] RSPM (R 4.3.0) ## mime 0.12 2021-09-28 [1] RSPM (R 4.3.0) ## miniUI 0.1.1.1 2018-05-18 [1] RSPM (R 4.3.0) ## openssl 2.1.1 2023-09-25 [1] RSPM (R 4.3.0) ## ottrpal 1.2.1 2024-06-11 [1] Github (jhudsl/ottrpal@828539f) ## pillar 1.9.0 2023-03-22 [1] RSPM (R 4.3.0) ## pkgbuild 1.4.3 2023-12-10 [1] RSPM (R 4.3.0) ## pkgconfig 2.0.3 2019-09-22 [1] RSPM (R 4.3.0) ## pkgload 1.3.4 2024-01-16 [1] RSPM (R 4.3.0) ## profvis 0.3.8 2023-05-02 [1] RSPM (R 4.3.0) ## promises 1.2.1 2023-08-10 [1] RSPM (R 4.3.0) ## purrr 1.0.2 2023-08-10 [1] RSPM (R 4.3.0) ## R6 2.5.1 2021-08-19 [1] RSPM (R 4.3.0) ## Rcpp 1.0.12 2024-01-09 [1] RSPM (R 4.3.0) ## readr 2.1.5 2024-01-10 [1] RSPM (R 4.3.0) ## remotes 2.4.2.1 2023-07-18 [1] RSPM (R 4.3.0) ## rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.2) ## rmarkdown 2.27.1 2024-06-11 [1] Github (rstudio/rmarkdown@e1c93a9) ## sass 0.4.8 2023-12-06 [1] RSPM (R 4.3.0) ## sessioninfo 1.2.2 2021-12-06 [1] RSPM (R 4.3.0) ## shiny 1.8.0 2023-11-17 [1] RSPM (R 4.3.0) ## stringi 1.8.3 2023-12-11 [1] RSPM (R 4.3.0) ## stringr 1.5.1 2023-11-14 [1] RSPM (R 4.3.0) ## tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.2) ## tzdb 0.4.0 2023-05-12 [1] RSPM (R 4.3.0) ## urlchecker 1.0.1 2021-11-30 [1] RSPM (R 4.3.0) ## usethis 2.2.3 2024-02-19 [1] RSPM (R 4.3.0) ## utf8 1.2.4 2023-10-22 [1] RSPM (R 4.3.0) ## vctrs 0.6.5 2023-12-01 [1] RSPM (R 4.3.0) ## xfun 0.44.4 2024-06-11 [1] Github (yihui/xfun@9da62cc) ## xml2 1.3.6 2023-12-04 [1] RSPM (R 4.3.0) ## xtable 1.8-4 2019-04-21 [1] RSPM (R 4.3.0) ## yaml 2.3.8 2023-12-11 [1] RSPM (R 4.3.0) ## ## [1] /usr/local/lib/R/site-library ## [2] /usr/local/lib/R/library ## ## ────────────────────────────────────────────────────────────────────────────── "],["references.html", "Chapter 2 References", " Chapter 2 References "],["404.html", "Page not found", " Page not found The page you requested cannot be found (perhaps it was moved or renamed). You may want to try searching to find the page's new location, or use the table of contents to find the page you are looking for. "]]