These functions construct vectors of given length, with attributes specified via dots. Except for list_len() and bytes_len(), the empty vectors are filled with typed missing values. This is in contrast to the base function base::vector() which creates zero-filled vectors.

lgl_len(.n)

int_len(.n)

dbl_len(.n)

chr_len(.n)

cpl_len(.n)

raw_len(.n)

bytes_len(.n)

list_len(.n)

Arguments

.n

The vector length.

See also

vector-along

Examples

list_len(10)
#> [[1]] #> NULL #> #> [[2]] #> NULL #> #> [[3]] #> NULL #> #> [[4]] #> NULL #> #> [[5]] #> NULL #> #> [[6]] #> NULL #> #> [[7]] #> NULL #> #> [[8]] #> NULL #> #> [[9]] #> NULL #> #> [[10]] #> NULL #>
lgl_len(10)
#> [1] NA NA NA NA NA NA NA NA NA NA