Calling a package

As a demonstration we will use the generate_primes() function from the primes package. This function takes two numbers as parameters and outputs all prime numbers inside their range.

In order to use a package we first need to load it. This can be done by applying the library() function and inserting the name of the package as the first argument of the function. After that, we have access to all of the content in the package and can use functions from it as usual.

Input
library(primes)
generate_primes(min = 500, max = 550)
Output
[1] 503 509 521 523 541 547
Use existing functions and data through packages