# Error: attempt to apply non-function in R (2 Examples)

In this R tutorial you’ll learn how to **handle the error message “attempt to apply non-function”**.

Table of contents:

Let’s do this:

## Example 1: Replicate the Error – attempt to apply non-function

Example 1 explains how to reproduce the error “attempt to apply non-function” in R.

Let’s assume that we want to perform a mathematical operation based on the values 2 and 3. Then we might try to execute some code as shown below:

2 (3) # No function specified # Error: attempt to apply non-function |

2 (3) # No function specified # Error: attempt to apply non-function

The RStudio console returns the error “attempt to apply non-function”. The reason for this is that we didn’t specify a mathematical operator or a function between the two values.

Next, I’ll explain how to solve this problem…

## Example 2: Fix the Error – attempt to apply non-function

This example shows how to avoid the error message “attempt to apply non-function”.

For this, we simply have to insert a mathematical operator between our two values. In this example, we’ll use the + sign:

2 + (3) # Plus sign between values # [1] 5 |

2 + (3) # Plus sign between values # [1] 5

No error – looks good!

## Video & Further Resources

Have a look at the following video of my YouTube channel. In the video, I’m explaining the topics of this article in the R programming language.

*The YouTube video will be added soon.*

Additionally, you may have a look at some of the other tutorials of this website. You can find a selection of tutorials below.

You learned in this tutorial how to **deal with the error “attempt to apply non-function”** in the R programming language. If you have additional comments and/or questions, let me know in the comments.