How to use a new function?

How to use a new function?

?function
help(function)

Example: How to use a new function?

?mean

Example: How to use a new function?

?mean

The Normal Distribution

  • rnorm: random sampling from the normal distribution
  • pnorm: cumulative density function of the normal distribution

The Normal Distribution: rnorm

rnorm(n, mean = 0, sd = 1)

The Normal Distribution: pnorm

pnorm(q, mean = 0, sd = 1, lower.tail = TRUE)

Important functionality: lower.tail

Empirical Cumulative Distribution Function (ECDF)

plot.ecdf(rnorm(100))

Empirical Cumulative Distribution Function (ECDF)

plot.ecdf(rnorm(1000), ylab = "ECDF(x)")

Plotting multiple ECDFs in the same graph

Hint: look through the examples on the function’s help page

How to compile your R script into a report?

Resources