tibble: Build a data frame or list.

Description Usage Arguments Details See Also Examples

Description

tibble() is a trimmed down version of data.frame() that:

  1. Never coerces inputs (i.e. strings stay as strings!).

  2. Never adds row.names.

  3. Never munges column names.

  4. Only recycles length 1 inputs.

  5. Evaluates its arguments lazily and in order.

  6. Adds tbl_df class to output.

  7. Automatically adds column names.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

...

A set of name-value pairs. Arguments are evaluated sequentially, so you can refer to previously created variables.

xs

A list of unevaluated expressions created with ~, quote(), or lazyeval::lazy().

Details

lst() is similar to list(), but like tibble(), it evaluates its arguments lazily and in order, and automatically adds names.

data_frame is an alias to tibble.

See Also

as_tibble() to turn an existing list into a data frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
a <- 1:5
tibble(a, b = a * 2)
tibble(a, b = a * 2, c = 1)
tibble(x = runif(10), y = x * 2)

lst(n = 5, x = runif(n))

# tibble never coerces its inputs
str(tibble(letters))
str(tibble(x = list(diag(1), diag(2))))

# or munges column names
tibble(`a + b` = 1:5)

# With the SE version, you give it a list of formulas/expressions
tibble_(list(x = ~1:10, y = quote(x * 2)))

# data frames can only contain 1d atomic vectors and lists
# and can not contain POSIXlt
## Not run: 
tibble(x = tibble(1, 2, 3))
tibble(y = strptime("2000/01/01", "%x"))

## End(Not run)

Robertus100/tibble documentation built on May 9, 2019, 10:09 a.m.