# `letters` contains the 26 letters of the English alphabet
# data.frames will recycle `letters` twice to match the length of `a` (52)
data.frame(
a = 1:52,
b = letters
)
#> a b
#> 1 1 a
#> 2 2 b
#> 3 3 c
#> 4 4 d
#> 5 5 e
#> 6 6 f
#> 7 7 g
#> 8 8 h
#> 9 9 i
#> 10 10 j
#> 11 11 k
#> 12 12 l
#> 13 13 m
#> 14 14 n
#> 15 15 o
#> 16 16 p
#> 17 17 q
#> 18 18 r
#> 19 19 s
#> 20 20 t
#> 21 21 u
#> 22 22 v
#> 23 23 w
#> 24 24 x
#> 25 25 y
#> 26 26 z
#> 27 27 a
#> 28 28 b
#> 29 29 c
#> 30 30 d
#> 31 31 e
#> 32 32 f
#> 33 33 g
#> 34 34 h
#> 35 35 i
#> 36 36 j
#> 37 37 k
#> 38 38 l
#> 39 39 m
#> 40 40 n
#> 41 41 o
#> 42 42 p
#> 43 43 q
#> 44 44 r
#> 45 45 s
#> 46 46 t
#> 47 47 u
#> 48 48 v
#> 49 49 w
#> 50 50 x
#> 51 51 y
#> 52 52 z
library(tibble)
# tibbles will not recycle values unless they are length 1.
# In other words, a column input can be one element long or the number of rows long
tibble(
a = 1:52,
b = letters
)
#> Error: Tibble columns must have compatible sizes.
#> * Size 52: Existing data.
#> * Size 26: Column `b`.
#> ℹ Only values of size one are recycled.
Created on 2021-11-14 by the reprex package (v2.0.1)