Description Usage Arguments Examples
Data opvullen met missende rijen. Standaard worden rijen aangevuld tussen de min en max van variabele
.
1 | complete_rows(data, variable, newvalue = 0, start_with_1 = FALSE)
|
data |
|
variable |
Variabele die numerieke waarden bevat en op basis waarvan de tabel aangevuld moet worden. |
newvalue |
Standaard is |
start_with_1 |
Standaard is |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | a <- data.frame(week = c(3, 5, 6),
x = c(14, 23, 16),
y = c(34, 31, 28))
a
# week x y
# 1 3 14 34
# 2 5 23 31
# 3 6 16 28
a %>% complete_rows(week)
# week x y
# 1 3 14 34
# 2 4 0 0
# 3 5 23 31
# 4 6 16 28
a %>% complete_rows(week, start_with_1 = TRUE)
# week x y
# 1 1 0 0
# 2 2 0 0
# 3 3 14 34
# 4 4 0 0
# 5 5 23 31
# 6 6 16 28
a %>% complete_rows(week, NA, start_with_1 = TRUE)
# week x y
# 1 1 NA NA
# 2 2 NA NA
# 3 3 14 34
# 4 4 NA NA
# 5 5 23 31
# 6 6 16 28
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.