R Notebook

This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

plot(cars)

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

plot (iris)

cars plot(cars,c(“speed”, “dist”))

plot(iris)

Chapter Two

R Markdown Format

Header 1

Header 2

Header 3

  • This is the first line

    • This is a sub-line
    • This is another sub-line
  • This actually goes to the outer level

  • This is definitely at the outer level

  • First line

  • Second line

    • nested line
  1. Charles is a good man and ambitious about his dreams.
  2. numbered
  3. list
Name Gender Occupation
Charles Kwame Appiah Male Renewable Energy Engineer
Richmond Amoah Male Fashion
Ann Amoah Female Doctor

this

this

Github

![Photos]

This is some text [with a link]

This is some text [with a link][interesting].

This is a block quote

block of
text
f <- function(x) ifelse(x %% 2 == 0, x**2, x**3)
f(2:20)
##  [1]    4   27   16  125   36  343   64  729  100 1331  144 2197  196 3375  256
## [16] 4913  324 6859  400

[this section][@ckappiah1999.com]

bibliography: bibliography.bib … —

[@smith04, chapter 4]

bibliography: bibliography.bib csl: biomed-central.csl … —

[@ckappiah1999.com]

Charles

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00
sum(cars)
## [1] 2919
mean(cars)
## Warning in mean.default(cars): argument is not numeric or logical: returning NA
## [1] NA
18250/2
## [1] 9125
20950 / 2
## [1] 10475
11000 / 2
## [1] 5500
library(knitr)
## Warning: package 'knitr' was built under R version 4.4.3
kable(head(cars))
speed dist
4 2
4 10
7 4
7 22
8 16
9 10
set.seed(123)  # Ensures reproducibility initially
random_numbers <- rnorm(200)  # Generate 100 random values
head(random_numbers)  # Display first few numbers
## [1] -0.56047565 -0.23017749  1.55870831  0.07050839  0.12928774  1.71506499
mean_random <- mean(random_numbers)
mean_random  # Compute and display the mean
## [1] -0.008570445