You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 05-scientific-notebooks.Rmd
+22-11Lines changed: 22 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -56,29 +56,29 @@ Because of all of these reasons, we encourage the use of computational notebooks
56
56
[Click this link to download](https://raw.githubusercontent.com/jhudsl/Reproducibility_in_Cancer_Informatics/main/chapter-zips/python-heatmap-chapt-5.zip).
Now double click your chapter zip file to unzip. For Windows you may have to [follow these instructions](https://support.microsoft.com/en-us/windows/zip-and-unzip-files-f6dde0a7-0fec-8294-e1d3-703ed85e7ebc).
Now double click your chapter zip file to unzip. For Windows you may have to [follow these instructions](https://support.microsoft.com/en-us/windows/zip-and-unzip-files-f6dde0a7-0fec-8294-e1d3-703ed85e7ebc).
@@ -165,11 +165,13 @@ Now, in your respective IDE, we'll turn our unreproducible scripts into notebook
165
165
1. Start a new notebook by going to `New` > `Notebook`.
166
166
2. Then open up this chapter’s example code folder and open the `make-heatmap.py` file.
167
167
168
-
<imgsrc ="https://docs.google.com/presentation/d/1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE/export/png?id=1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE&pageid=gfaa026a583_0_20"alt="In Jupyter, you can create a new notebook by going to New > Notebook. Then open up this chapter’s example code folder and open the make-heatmap.py file."style="display: block; margin: auto;" />
168
+
<imgsrc ="https://docs.google.com/presentation/d/1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE/export/png?id=1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE&pageid=gfaa026a583_0_20"alt="In Jupyter, you can create a new notebook by going to New then Notebook. Then open up this chapter’s example code folder and open the make-heatmap.py file." />
169
+
169
170
170
171
3. Create a new code chunk in your notebook.
171
172
172
-
<imgsrc ="https://docs.google.com/presentation/d/1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE/export/png?id=1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE&pageid=gfaa026a583_0_30"alt="The Jupyter interface has a ‘add a new chunk’ button, a delete chunk button, and a dropdown menu that allows you to choose the chunk type you’d like to add."style="display: block; margin: auto;" />
173
+
174
+
<imgsrc ="https://docs.google.com/presentation/d/1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE/export/png?id=1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE&pageid=gfaa026a583_0_30"alt="The Jupyter interface has a ‘add a new chunk’ button, a delete chunk button, and a dropdown menu that allows you to choose the chunk type you’d like to add." />
173
175
174
176
175
177
4. Now copy and paste all of the code from `make-heatmap.py` into a new chunk. We will later break up this large chunk of code into smaller chunks that are thematic in the next chapter.
@@ -182,26 +184,35 @@ For [more about using Jupyter notebooks see this](https://realpython.com/jupyter
182
184
<details> <summary>**Set up an R notebook**</summary>
183
185
184
186
1. Start a new notebook by going to `File` > `New File` > `R Notebook`.
185
-
2. Then open up this chapter’s example code folder and open the `make_heatmap.R` file.
186
187
187
-
<imgsrc ="https://docs.google.com/presentation/d/1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE/export/png?id=1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE&pageid=gfaa026a583_0_13"alt="In RStudio, you can create a new notebook by going to File > New File > R Notebook. Then open up this chapter’s example code folder and open the make_heatmap.R file."style="display: block; margin: auto;" />
188
+
<imgsrc ="https://docs.google.com/presentation/d/1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE/export/png?id=1LMurysUhCjZb7DVF6KS9QmJ5NBjwWVjRn40MS9f2noE&pageid=gfaa026a583_0_13"alt="In RStudio, you can create a new notebook by going to File then New File then R Notebook. Then open up this chapter’s example code folder and open the make_heatmap.R file." />
188
189
190
+
2. Then open up this chapter’s example code folder and open the `make_heatmap.R` file.
189
191
3. Practice creating a new chunk in your R notebook by clicking the `Code` > `Insert Chunk` button on the toolbar or by pressing `Cmd+Option+I` (in Mac) or `Ctrl + Alt + I` (in Windows). (You can also manually type out the back ticks and `{}`)
190
192
4. Delete all the default text in this notebook but keep the header which is surrounded by `---` and looks like:
193
+
191
194
`````
192
195
title: "R Notebook"
193
196
output: html_notebook
194
197
`````
195
-
You can feel free to change the title from `R Notebook` to something that better suits the contents of this notebook.
198
+
You can feel free to change the title from `R Notebook` to something that better suits the contents of this notebook.
199
+
196
200
5. Now copy and paste all of the code from `make_heatmap.R` into a new chunk. We will later break up this large chunk of code into smaller chunks that are thematic in the next chapter.
197
201
6. Save your `untitled.Rmd` into something that tells us what it will end up doing like `make-heatmap.Rmd`.
198
202
7. Notice that upon saving your `.Rmd` file, a new file `.nb.html` file of the same name is created. Open that file and choose `view in Browser`. If RStudio asks you to choose a browser, then choose a default browser.
199
203
8. This shows the nicely rendered version of your analysis and snapshots whatever output existed when the `.Rmd` file was saved.
200
204
201
205
For [more about using R notebooks see this](https://bookdown.org/yihui/rmarkdown/) by @Xie2018.
202
206
207
+
208
+
209
+
203
210
</details>
204
211
212
+
213
+
<br>
214
+
<br>
215
+
205
216
Now that you've created your notebook, you are ready to start polishing that code!
206
217
207
218
**Any feedback you have regarding this exercise is greatly appreciated; you can fill out [this form](https://forms.gle/ygSSwoGaEATA2S65A)!**
0 commit comments