vctrs

Generic programming with typed R vectors

https://github.com/r-lib/vctrs

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 36 committers (5.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (20.7%) to scientific vocabulary

Keywords

r s3-vectors

Keywords from Contributors

unit-testing tidy-data data-manipulation grammar visualisation documentation-tool setup parsing fwf csv
Last synced: 10 months ago · JSON representation

Repository

Generic programming with typed R vectors

Basic Info
  • Host: GitHub
  • Owner: r-lib
  • License: other
  • Language: C
  • Default Branch: main
  • Homepage: https://vctrs.r-lib.org
  • Size: 26.8 MB
Statistics
  • Stars: 295
  • Watchers: 10
  • Forks: 68
  • Open Issues: 201
  • Releases: 27
Topics
r s3-vectors
Created almost 10 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
---



```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# vctrs 


[![Codecov test coverage](https://codecov.io/gh/r-lib/vctrs/graph/badge.svg)](https://app.codecov.io/gh/r-lib/vctrs)
![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)
[![R-CMD-check](https://github.com/r-lib/vctrs/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/vctrs/actions/workflows/R-CMD-check.yaml)


There are three main goals to the vctrs package, each described in a vignette:

* To propose `vec_size()` and `vec_ptype()` as alternatives to `length()` and
  `class()`; `vignette("type-size")`. These definitions are paired with a
  framework for size-recycling and type-coercion. `ptype` should evoke the
  notion of a prototype, i.e. the original or typical form of something.
  
* To define size- and type-stability as desirable function properties, use
  them to analyse existing base functions, and to propose better alternatives;
  `vignette("stability")`. This work has been particularly motivated by
  thinking about the ideal properties of `c()`, `ifelse()`, and `rbind()`.
  
* To provide a new `vctr` base class that makes it easy to create new S3
  vectors; `vignette("s3-vector")`. vctrs provides methods for many base 
  generics in terms of a few new vctrs generics, making implementation 
  considerably simpler and more robust.
  
vctrs is a developer-focussed package. Understanding and extending vctrs requires some effort from developers, but should be invisible to most users. It's our hope that having an underlying theory will mean that users can build up an accurate mental model without explicitly learning the theory. vctrs will typically be used by other packages, making it easy for them to provide new classes of S3 vectors that are supported throughout the tidyverse (and beyond). For that reason, vctrs has few dependencies.

## Installation

Install vctrs from CRAN with:

```{r, eval = FALSE}
install.packages("vctrs")
```

Alternatively, if you need the development version, install it with:

```{r, eval = FALSE}
# install.packages("pak")
pak::pak("r-lib/vctrs")
```

## Usage

```{r}
library(vctrs)

# Sizes
str(vec_size_common(1, 1:10))
str(vec_recycle_common(1, 1:10))

# Prototypes
str(vec_ptype_common(FALSE, 1L, 2.5))
str(vec_cast_common(FALSE, 1L, 2.5))
```

## Motivation

The original motivation for vctrs comes from two separate but related problems. The first problem is that `base::c()` has rather undesirable behaviour when you mix different S3 vectors:

```{r}
# combining factors makes integers
c(factor("a"), factor("b"))

# combining dates and date-times gives incorrect values; also, order matters
dt <- as.Date("2020-01-01")
dttm <- as.POSIXct(dt)

c(dt, dttm)
c(dttm, dt)
```

This behaviour arises because `c()` has dual purposes: as well as its primary duty of combining vectors, it has a secondary duty of stripping attributes. For example, `?POSIXct` suggests that you should use `c()` if you want to reset the timezone. 

The second problem is that `dplyr::bind_rows()` is not extensible by others. Currently, it handles arbitrary S3 classes using heuristics, but these often fail, and it feels like we really need to think through the problem in order to build a principled solution. This intersects with the need to cleanly support more types of data frame columns, including lists of data frames, data frames, and matrices.

Owner

  • Name: R infrastructure
  • Login: r-lib
  • Kind: organization

GitHub Events

Total
  • Issues event: 37
  • Watch event: 9
  • Delete event: 8
  • Issue comment event: 58
  • Push event: 41
  • Pull request review comment event: 31
  • Pull request review event: 20
  • Pull request event: 28
  • Fork event: 4
  • Create event: 12
Last Year
  • Issues event: 37
  • Watch event: 9
  • Delete event: 8
  • Issue comment event: 58
  • Push event: 41
  • Pull request review comment event: 31
  • Pull request review event: 20
  • Pull request event: 28
  • Fork event: 4
  • Create event: 12

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 3,555
  • Total Committers: 36
  • Avg Commits per committer: 98.75
  • Development Distribution Score (DDS): 0.454
Past Year
  • Commits: 3
  • Committers: 2
  • Avg Commits per committer: 1.5
  • Development Distribution Score (DDS): 0.333
Top Committers
Name Email Commits
Lionel Henry l****y@g****m 1,942
DavisVaughan d****s@r****m 889
hadley h****m@g****m 550
Kirill Müller k****r 105
Romain François r****n@r****m 15
Jenny Bryan j****n@g****m 12
Maximilian Held i****o@m****e 6
Mara Averick m****k@g****m 3
Earo Wang e****g@g****m 2
Evgeni Chasnovski e****i@g****m 2
Hiroaki Yutani y****i@g****m 2
Ian Lyttle i****e 2
Jim Hester j****r@g****m 2
Chao Cheng 4****4@q****m 1
Daniel Possenriede p****e@g****m 1
Danny Smith d****y@g****g 1
juangomezduaso j****o 1
coreyyanofsky c****y@s****t 1
chsafouane 3****e 1
Zachary Foster z****9@g****m 1
Scott Brenstuhl b****r@m****u 1
Salim B s****m@p****e 1
Pavel Marek p****k@g****m 1
Michael Sumner m****r@g****m 1
Michael Chirico m****4@g****m 1
Maximilian Girlich m****h@m****m 1
Josiah Parry j****y@g****m 1
Jesse Sadler 2****r 1
JamesCuster 3****r 1
James Laird-Smith j****h@g****m 1
and 6 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 175
  • Total pull requests: 105
  • Average time to close issues: 2 months
  • Average time to close pull requests: 28 days
  • Total issue authors: 111
  • Total pull request authors: 18
  • Average comments per issue: 1.51
  • Average comments per pull request: 0.71
  • Merged pull requests: 68
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 32
  • Pull requests: 24
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 7 days
  • Issue authors: 23
  • Pull request authors: 5
  • Average comments per issue: 1.03
  • Average comments per pull request: 0.88
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • DavisVaughan (42)
  • lionel- (5)
  • mgirlich (4)
  • tzakharko (3)
  • krlmlr (3)
  • billdenney (3)
  • khusmann (3)
  • mmaughan0 (3)
  • avrenli2 (2)
  • mjskay (2)
  • hadley (2)
  • bart1 (2)
  • arnaudgallou (2)
  • TimTaylor (2)
  • evanwils0n (1)
Pull Request Authors
  • DavisVaughan (68)
  • MichaelChirico (8)
  • hadley (5)
  • lbm364dl (5)
  • olivroy (2)
  • JosiahParry (2)
  • krlmlr (2)
  • brookslogan (2)
  • orgadish (2)
  • mjskay (1)
  • mdsumner (1)
  • khusmann (1)
  • fenguoerbian (1)
  • yutannihilation (1)
  • georgestagg (1)
Top Labels
Issue Labels
feature (9) bug (6) dplyr (5) op:bind-combine (3) op:identity-vectorness (2) reprex (2) type:fallback (1) numeric-arith (1) conditions (1) performance (1) theory (1) type:factor (1) type:dataframe (1) op:sort (1) op:proxy-restore (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 1,343,501 last-month
  • Total docker downloads: 164,043,642
  • Total dependent packages: 282
  • Total dependent repositories: 886
  • Total versions: 27
  • Total maintainers: 1
cran.r-project.org: vctrs

Vector Helpers

  • Versions: 27
  • Dependent Packages: 282
  • Dependent Repositories: 886
  • Downloads: 1,343,501 Last month
  • Docker Downloads: 164,043,642
Rankings
Downloads: 0.0%
Dependent repos count: 0.4%
Dependent packages count: 0.4%
Forks count: 1.1%
Stargazers count: 1.6%
Average: 3.5%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 3.3 depends
  • cli >= 3.4.0 imports
  • glue * imports
  • lifecycle >= 1.0.3 imports
  • rlang >= 1.0.6 imports
  • bit64 * suggests
  • covr * suggests
  • crayon * suggests
  • dplyr >= 0.8.5 suggests
  • generics * suggests
  • knitr * suggests
  • pillar >= 1.4.4 suggests
  • pkgdown >= 2.0.1 suggests
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests
  • tibble >= 3.1.3 suggests
  • waldo >= 0.2.0 suggests
  • withr * suggests
  • xml2 * suggests
  • zeallot * suggests