library(tidyverse)
ARES40011 Workbook
Week 1
Formatting notes
Remember the cheat sheet under the help menu!
One * for italics two for bold
When comfortable/knowledgeable you can edit in both Visual (has buttons to help with new things) or Source (more code looking).
For example, I do not know know how to insert tables or images in the source code. The visual input can help with this.
Issue When adding this image, using both a web link for the image or a local document, it is rendering correctly locally, but then when I publish, the image is being lost. I need help with this
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
The above code would usually display a table of data relating to the tidyverse package, however, as we have added an output:false instruction it is not doing so here.
These call out sections are called “chunks”.
From the pre-work for this week, I had successfully imported a data set from dropbox using the following code. However, this is now returning the error more columns than column names. What is the fix for this?
SOLVED I typed the web address incorrectly several times and on several attempts!
<- read.table(file="https://www.dropbox.com/s/5q3hdyxcouw6ifa/cyanistes.txt?dl=1",header=TRUE,dec=".") cyan
Issue I have added label to this, but it is not appearing on the render. Ask about this
Add a plot
Code
ggplot(diamonds, aes(x=cut)) +
geom_bar()
You can refer to areas. This is a reference: Figure 1
Using LaTeX
We can put formulas inline like this: \(\alpha\)
We indent like this
\[\pi \in \mathbb{r}\] Google LaTeX for more options and guides.
Other display options
For different output types, you can change the format of the document at the top of the code.
Examples include: - PDF - Slides, use revealjs at format for this. Looks like MS SWAY. Be cautions with this though as some changes will be required to ensure display of code sections works. From the example video, adding echo: true to code to sort this. There are lots of options with the slides.
watch more tutorials on this
You can also add additional options to the file types. Under format in yarl header, you can select themes. Web search for more Quatro Themes
To add a table of contents, you can add TOC within the HTML format area. Further customization is available - use the crtl+space options to explore.
You can also have multiple outputs at once e.g. HTML and PDF at once.
Other useful stuff!
-use crtl + space to see autofill possibilities within code or yarl sections
-you can set global, as in the default across the code, in the yarl header area too.
-you can add additional code in other languages by changing the info between the {} in the chunks.
Using python example
this is where I got stuck error - python biding not loaded. code removed as unable to render/publish.
Week 2 - During session notes
-Added callout boxes to highlight areas in week 1s notes.
library(palmerpenguins)
library(tidyverse) # added again as was not running
Tasks for this week:
Play around with penguin data
Insert a picture into the workbook done
Playing with Penguin data
%>%
penguins glimpse()
Rows: 344
Columns: 8
$ species <fct> Adelie, Adelie, Adelie, Adelie, Adelie, Adelie, Adel~
$ island <fct> Torgersen, Torgersen, Torgersen, Torgersen, Torgerse~
$ bill_length_mm <dbl> 39.1, 39.5, 40.3, NA, 36.7, 39.3, 38.9, 39.2, 34.1, ~
$ bill_depth_mm <dbl> 18.7, 17.4, 18.0, NA, 19.3, 20.6, 17.8, 19.6, 18.1, ~
$ flipper_length_mm <int> 181, 186, 195, NA, 193, 190, 181, 195, 193, 190, 186~
$ body_mass_g <int> 3750, 3800, 3250, NA, 3450, 3650, 3625, 4675, 3475, ~
$ sex <fct> male, female, female, NA, female, male, female, male~
$ year <int> 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007, 2007~