# R Error: Arguments Imply Differing Number of Rows (2 Examples)

This article illustrates how to handle the error message “arguments imply differing number of rows” in the R programming language.

The content of the post is structured like this:

Let’s dive right in:

## Example 1: Replicating the Error Message: arguments imply differing number of rows

In Example 1, I’ll illustrate how to reproduce the error “arguments imply differing number of rows”. Have a look at the following R code:

```data.frame(x1 = 1:5, # Wrong application of data.frame x2 = 1:6) # Error in data.frame(x1 = 1:5, x2 = 1:6) : # arguments imply differing number of rows: 5, 6```

As you can see, the RStudio console returns the error “arguments imply differing number of rows”.

The reason for this is that we tried to create a data frame with unequal variable lengths (i.e. x1 has a length of five and x2 has a length of six).

## Example 2: Fixing the Error Message: arguments imply differing number of rows

In this Section, I’ll illustrate how to solve the error message “arguments imply differing number of rows”:

```data.frame(x1 = c(1:5, NA), # Proper application of data.frame x2 = 1:6) # x1 x2 # 1 1 1 # 2 2 2 # 3 3 3 # 4 4 4 # 5 5 5 # 6 NA 6```

In the previous R code we added an NA value at the end of the shorter column. This way, we created two variables with even length.

## Video & Further Resources

Do you need more explanations on the R syntax of this tutorial? Then you might want to watch the following video of my YouTube channel. I’m explaining the R programming syntax of this tutorial in the video:

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party. If you accept this notice, your choice will be saved and the page will refresh.

In addition, I can recommend to read the related articles of my homepage.

In summary: You learned in this article how to deal with the error “arguments imply differing number of rows” in the R programming language. Don’t hesitate to let me know in the comments below, in case you have additional questions.

Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

#### 2 Comments.Leave new

• Aaron D. Cherniak
May 10, 2021 6:55 pm

Hi Joachim. Is the video coming soon?
I’m not following the answer.