Package

Install and load package “tibble”.

Create dummy data

df <- tibble(x = 1:3, y = 3:1)

Add a row without specifying the place

The row is added in the end of the data frame.

df %>% add_row(x = 4, y = 0)
## # A tibble: 4 x 2
##       x     y
##   <dbl> <dbl>
## 1     1     3
## 2     2     2
## 3     3     1
## 4     4     0

Add a row and specify where to add the new rows

df %>% add_row(x = 4, y = 0, .before = 2)
## # A tibble: 4 x 2
##       x     y
##   <dbl> <dbl>
## 1     1     3
## 2     4     0
## 3     2     2
## 4     3     1

You can supply vectors, to add multiple rows

df %>% add_row(x = 4:5, y = 0:-1)
## # A tibble: 5 x 2
##       x     y
##   <int> <int>
## 1     1     3
## 2     2     2
## 3     3     1
## 4     4     0
## 5     5    -1

Absent variables get missing values

df %>% add_row(x = 4)
## # A tibble: 4 x 2
##       x     y
##   <dbl> <int>
## 1     1     3
## 2     2     2
## 3     3     1
## 4     4    NA