Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tidyverse/tibble
A modern re-imagining of the data frame
https://github.com/tidyverse/tibble
r tidy-data
Last synced: 25 days ago
JSON representation
A modern re-imagining of the data frame
- Host: GitHub
- URL: https://github.com/tidyverse/tibble
- Owner: tidyverse
- License: other
- Created: 2015-10-28T23:57:00.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2024-05-31T01:38:22.000Z (7 months ago)
- Last Synced: 2024-06-11T17:11:04.572Z (6 months ago)
- Topics: r, tidy-data
- Language: R
- Homepage: https://tibble.tidyverse.org/
- Size: 65.3 MB
- Stars: 652
- Watchers: 34
- Forks: 131
- Open Issues: 47
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Support: .github/SUPPORT.md
Awesome Lists containing this project
- Road2R - tibble - efficient display structure for tabular data. (Table of Contents / Data manipulation)
- jimsghstars - tidyverse/tibble - A modern re-imagining of the data frame (R)
README
---
output: downlit::readme_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```# tibble
[![R-CMD-check](https://github.com/tidyverse/tibble/workflows/rcc/badge.svg)](https://github.com/tidyverse/tibble/actions)
[![Codecov test coverage](https://codecov.io/gh/tidyverse/tibble/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/tibble?branch=main)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/tibble)](https://cran.r-project.org/package=tibble)
[![Life cycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)## 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 chapter](https://r4ds.had.co.nz/tibbles.html) in *R for data science*.
## Installation
```{r, eval = FALSE}
# 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
```{r}
library(tibble)
```Create a tibble from an existing object with `as_tibble()`:
```{r}
data <- data.frame(a = 1:3, b = letters[1:3], c = Sys.Date() - 1:3)
dataas_tibble(data)
```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()`:
```{r}
tibble(x = 1:5, y = 1, z = x^2 + y)
````tibble()` does much less than `data.frame()`: it never changes the type of the inputs (e.g. it keeps list columns as is), 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 `vignette("tibble")`.
You can define a tibble row-by-row with `tribble()`:
```{r}
tribble(
~x, ~y, ~z,
"a", 2, 3.6,
"b", 1, 8.5
)
```## Related work
The tibble print method draws inspiration from [data.table](https://rdatatable.gitlab.io/data.table), and [frame](https://github.com/patperry/r-frame). Like `data.table::data.table()`, `tibble()` doesn't change column names and doesn't use rownames.
---
## Code of ConductPlease note that the tibble project is released with a [Contributor Code of Conduct](https://tibble.tidyverse.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.