Control + alt + I for the shortcut to begin the chunk of code.

Control + Shift + K for the shortcut to knit.

Control + Shift + Enter for the shortcut to run the current chunk.

Control + Alt + R for the shortcut to run all.

These are the first r setup chunk within six backdashes: {r setup, include=FALSE} knitr::opts_chunk$set(dev = “png”, dpi=300, echo = TRUE, message = F, warning = F, tidy=TRUE, tidy.opts=list(width.cutoff=80))

message = F, warning = F helps to stop helps to stop printing out warning and message but will print out the errors if any.

Make sure you have installed formatR package.

tidy=TRUE, tidy.opts=list(width.cutoff=80) helps to start a new line when the code output is too long.

library(tidyverse)

The three dots beneath the renew button you can open a new path and click on more to set as working directory. Also you can use setwd() for doing that. Click on the datasets you want to open and click on import data, you can view the dataset with type of each column and copy the second line to read the csv.

HDBCarparkInformation <- read_csv("data/HDBCarparkInformation.csv")
morningcarparl <- subset(HDBCarparkInformation, night_parking == "NO")
summary(HDBCarparkInformation$gantry_height)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    1.90    2.15    2.45    4.00    9.99
Withheight <- subset(HDBCarparkInformation, gantry_height != 0 & gantry_height !=
    9.99)
summary(Withheight$gantry_height)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.700   2.150   2.150   2.857   4.500   5.400
number <- summary(Withheight$gantry_height)

This is `r number`

Results: 1.7, 2.15, 2.15, 2.8569719, 4.5, 5.4

Typing number is `r number` results in: x is 1.7, 2.15, 2.15, 2.8569719, 4.5, 5.4

Centers <- read_csv("data/ListofGovernmentMarketsHawkerCentres.csv")
nrow(Centers)
## [1] 107
summary(Centers$no_of_stalls)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    21.0    79.0   119.0   131.4   165.0   703.0
larger <- subset(Centers, no_of_stalls >= 400)
larger$name_of_centre
## [1] "Chinatown Market" "Tekka Market"

The largest center has 703 stalls. The centers with over 400 stalls are Chinatown Market, Tekka Market.

Several ways to create unordered list:

Another way:

Ordered list:

  1. Item 1
  2. Item 2 The leading number doesn’t matter
  3. Item 3

1. If you want exactly the number you specify, add a \ after the number and before the dot. It is actually not a list but a text that looks like a list, and cannot automatically add the number.

2. But by doing this, you don’t get the indent.

3. And you need to add an enter before each line.

ggplot(data = Centers, mapping = aes(x = no_of_stalls)) + geom_histogram(bins = 50)