Tag Archives: functions in R

Functions in R

Hug Point Oregon Coast
Hug Point Oregon Coast

Wish I was at the coast.

R does a lot with functions. Let’s start with a simple function statement. The base R has a function called function.

In the following code:

f is the objects name

x is the varible

the function x +1 goes between { }

Pretty simple

f <- function(x) {x + 1}

Take
f(4)

results

[1] 5

Write your code try other functions. It is easier to write a function in R than other languages.