This Week’s Coding Goals
Since I have never done any coding before, the idea of coding did seem a little scary at first, but I was excited to make a start nonetheless. So here’s what I wanted to achieve this week:
- watch Danielle’s Wk 1 R markdown videos
- create my first R markdown project and get used to:
- inserting pictures, quotes
- using lists
- emphasising text etc.
- play around with the themes to find something I like
- learn how to use Rpubs and publish this learning log there
Achieving those goals
I watched Danielle’s videos and followed along to create my first project, and followed along to make sure I got some practice with all the different features with plain markdown and R markdown.
Here’s an example of some code:
print("please enjoy some pictures of tinkerbell having a nap below")## [1] "please enjoy some pictures of tinkerbell having a nap below"
and an interesting tarot cat meme
And here are some equations:
Pythagoras: \(a^2 + b^2 = c^2\)
Perfect square: \[ (a+b)^2 = a^2 + 2ab + b^2 \]
Challenges
Okay there were a few things here and there.
I somehow seemed to always forget if I need a space or not for emphasising text vs. when using headings a lot (since headings need a space after the hash key, and emphasising text doesn’t between the the asterisks). But I feel like with practice, this challenge would be solved pretty easily.
I realised I needed to add in a lot more blank rows than I initially thought to separate different lines of text, as well as to make sure text doesn’t end up beside my image (unless I wanted that, which I now know that I simply would omit the blank row)
I did not know how to code theme and a toc together, since I couldn’t find in Danielle’s slides/videos. I tried guessing whether I needed to specify the theme before including toc: true or the other way around, as well as if an additional indentation was needed since I was adding a theme and toc. Eventually I figured it out, I could put both the theme and toc: true at the same level of indentation under the html document section.
Successes
I found creating lists, numbered and non-numbered pretty simple, including nested lists
I thought inserting equations would be hard, but it turned out pretty okay
And customising with themes and headings etc went pretty smoothly. I didn’t particularly like any of the default themes in R markdown so I did some googling to figure out how to use other themes and finally I found one I liked. It’s called architect from here.There are also instructions here for any else who may be interested :) Oh also, I realised that floating toc doesn’t work with these themes, only the themes that R already has.
Also, I did some googling to find out how to change the size of images since I wanted the two photos to be of the same size as they are next to each other. It was easier than I thought, I just had to add {width=%} after the image and change the value in front of the percentage.
What’s next?
- I am excited to work through next weeks coding content - data visualization
- And possibly some more practice to further familiarise myself with R markdown