tibble v1.3.1

0

Monthly downloads

0th

Percentile

Simple Data Frames

Provides a 'tbl_df' class (the 'tibble') that provides stricter checking and better formatting than the traditional data frame.

Readme

tibble

Build Status AppVeyor Build Status Coverage Status CRAN\_Status\_Badge

Overview

A tibble, or tbl_df, is a modern reimagining of the data.frame, keeping what time has proven to be effective, and throwing out what is not. Tibbles are data.frames that are lazy and surly: they do less (i.e. they don't change variable names or types, and don't do partial matching) and complain more (e.g. when a variable does not exist). This forces you to confront problems earlier, typically leading to cleaner, more expressive code. Tibbles also have an enhanced print method() which makes them easier to use with large datasets containing complex objects.

If you are new to tibbles, the best place to start is the tibbles in R for data science.

Installation

# The easiest way to get tibble is to install the whole tidyverse:
install.packages("tidyverse")

# Alternatively, install just tibble:
install.packages("tibble")

# Or the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("tidyverse/tibble")

Usage

Create a tibble from an existing object with as_tibble():

library(tibble)
as_tibble(iris)
#> # A tibble: 150 × 5
#>    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
#>           <dbl>       <dbl>        <dbl>       <dbl>  <fctr>
#> 1           5.1         3.5          1.4         0.2  setosa
#> 2           4.9         3.0          1.4         0.2  setosa
#> 3           4.7         3.2          1.3         0.2  setosa
#> 4           4.6         3.1          1.5         0.2  setosa
#> 5           5.0         3.6          1.4         0.2  setosa
#> 6           5.4         3.9          1.7         0.4  setosa
#> 7           4.6         3.4          1.4         0.3  setosa
#> 8           5.0         3.4          1.5         0.2  setosa
#> 9           4.4         2.9          1.4         0.2  setosa
#> 10          4.9         3.1          1.5         0.1  setosa
#> # ... with 140 more rows

This will work for reasonable inputs that are already data.frames, lists, matrices, or tables.

You can also create a new tibble from column vectors with tibble():

tibble(x = 1:5, y = 1, z = x ^ 2 + y)
#> # A tibble: 5 × 3
#>       x     y     z
#>   <int> <dbl> <dbl>
#> 1     1     1     2
#> 2     2     1     5
#> 3     3     1    10
#> 4     4     1    17
#> 5     5     1    26

tibble() does much less than data.frame(): it never changes the type of the inputs (e.g. it never converts strings to factors!), it never changes the names of variables, it only recycles inputs of length 1, and it never creates row.names(). You can read more about these features in the vignette, vignette("tibble").

You can define a tibble row-by-row with tribble():

tribble(
  ~x, ~y,  ~z,
  "a", 2,  3.6,
  "b", 1,  8.5
)
#> # A tibble: 2 × 3
#>       x     y     z
#>   <chr> <dbl> <dbl>
#> 1     a     2   3.6
#> 2     b     1   8.5

Functions in tibble

Name Description
is.tibble Test if the object is a tibble.
knit_print.trunc_mat knit_print method for trunc mat
glimpse Get a glimpse of your data.
has_name Does an object have an element with this name?
add_column Add columns to a data frame
add_row Add rows to a data frame
tibble-package tibble: Simple Data Frames
lst Build a list
format.tbl Tools for describing matrices
frame_matrix Row-wise matrix creation
obj_sum Provide a succinct summary of an object
rownames Tools for working with row names
enframe Converting atomic vectors to data frames, and vice versa
as_tibble Coerce lists and matrices to data frames.
set_tidy_names Repair object names.
tribble Row-wise tibble creation
No Results!

Last month downloads

Details

Encoding UTF-8
URL http://tibble.tidyverse.org/, https://github.com/tidyverse/tibble
BugReports https://github.com/tidyverse/tibble/issues
LinkingTo Rcpp
LazyData yes
License MIT + file LICENSE
RoxygenNote 6.0.1
VignetteBuilder knitr
NeedsCompilation yes
Packaged 2017-05-16 16:39:54 UTC; muelleki
Repository CRAN
Date/Publication 2017-05-17 07:09:18 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/tibble)](http://www.rdocumentation.org/packages/tibble)