From 19f5e102133f76381f335c679ccce56d4755b492 Mon Sep 17 00:00:00 2001 From: hadley Date: Thu, 7 Jul 2016 08:03:39 -0500 Subject: [PATCH] Wrangle tweaks --- wrangle.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrangle.Rmd b/wrangle.Rmd index 9d15d79..e0c2917 100644 --- a/wrangle.Rmd +++ b/wrangle.Rmd @@ -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: