Wrangle tweaks

This commit is contained in:
hadley 2016-07-07 08:03:39 -05:00
parent d8f0c87ecf
commit 19f5e10213
1 changed files with 2 additions and 2 deletions

View File

@ -18,13 +18,13 @@ as_tibble(iris)
`as_tibble()` knows how to convert data frames, lists (provided the elements are equal length vectors), matrices, and tables.
You can also create a new tibble from individual vectors with `tibble()`:
You can create a new tibble from individual vectors with `tibble()`:
```{r}
tibble(x = 1:5, y = 1, z = x ^ 2 + y)
```
Note that `tibble()` automatically recycles inputs of length 1, and you can refer to variables that you just created. Compared to `data.frame()`, `tibble()` does much less: it never changes the type of the inputs (e.g. it never converts strings to factors!), it never changes the names of variables, and it never creates `row.names()`.
`tibble()` automatically recycles inputs of length 1, and you can refer to variables that you just created. Compared to `data.frame()`, `tibble()` does much less: it never changes the type of the inputs (e.g. it never converts strings to factors!), it never changes the names of variables, and it never creates `row.names()`.
Another way to create a tibble is with `frame_data()`, which is customised for data entry in R code. Column headings are defined by formulas (`~`), and entries are separated by commas: