R: Create a Series Function

Use a function to produce a series

In this article I’ll demonstrate how to use the R language to create a function to produce a series, then print it to the screen.

First, I’ll declare a function which produces a series from 1-5, assign it to the variable ‘f’, then invoke the function, which prints the series on the screen.