A curated list of amazingly awesome R vector classes, and the packages that provide them.
Please read CONTRIBUTING if you wish to add a new vector class.
- Awesome VectoRs
- Resources
Classes that wrap numbers.
hexmode- Hexadecimal numbers:2Ainteger- 32-bit integers:1numeric- Floating-point numbers:1.234567numeric_version- Software versions:'1.23.456'octmode- Octal numbers:52
bigfloat- High precision numbers:0.33333333333333333333333333333333333333333333333333biginteger- Arbitrary precision integers:25852016738884976640000
deb_decimal- Non-decimal currencies asdoublewithunitandbasesattributes:3.825deb_lsd- Tripartite non-decimal currencies:8:13s:4ddeb_tetra- Tetrapartite non-decimal currencies:8:13s:4d:3f
quantities- Numbers with units and uncertainty:1 ± 0.3 [m/s]
Classes that wrap dates and times.
aweek- Weeks that start on any day of the week:2020-W10-2
POSIXct- Calendar time with time zone, stored as days since epoch:2020-03-03 09:16:17 CETPOSIXlt- Calendar time with time zone, stored as record of components:2020-03-03 09:16:17 CET
calendar- Alternative representations of calendar dates, such as year-quarter-day or year-month-weekday:2019-02-Sun[2]time_point- Variable precision points in time, with and without time zones:"2020-02-01 02:03:04.000005"
date_y- Years:2020date_yq- Year-quarter:2020-Q1date_ym- Year-month:2013-M12date_yw- Year-week:2013-W12
Classes that wrap character strings.
chars- Strings as iterable sets of characters:"abc"(classchars)
Classes that wrap complex objects.
blob- Binary Large OBjects:blob[42 B]
phone- Phone numbers parsed with Google's libphonenumber for formatting and further processing:# Parsed phone numbers: 5 total, 4 successfully parsed
labelled- Labelled vectors:<Labelled double> 3with labels
intrval- Relational operators for intervals:x %[]% c(a, b)
iv- Interval vectors:[2019-01-05, 2019-05-06) [2019-01-06, 2019-05-22)
mixed_units- Numbers with different units:1 [m], 2 [kg]
tfd- Tidy functional data:(0.0, 2.84);(0.5, -0.51);(1.0, -0.51)tfb- Tidy functional basis data:(0.0, 2.84);(0.5, -0.51);(1.0, -0.51)
Classes related to computing
ip_address- IP address:192.168.0.1ip_interface- IP interface:192.168.0.1/24ip_network- IP network:192.168.0.0/24
Classes related to geospatial
geos_geometry- Geometry vector as GEOS external pointers:<POINT (0 1)>
s2_geography,s2_cell- Geometry vector of points on the sphere as external pointers to S2 objects, S2 cell IDs as 64-bit integers:<POINT (0 1)>
sfc- Geometry vector in spatial data frames:POINT (0 1)
crc- Circle:[1 2, r = 0.5]wkb- Well-known binary geometry:<POINT (0 1)>wkt- Well-known text geometry:POINT (0 1)xy- Points:(1 4)rct- Rectangle:[1 2 3 4]
Classes implemented by packages for their own use
tokenlist- List of tokens:[3 tokens]with number of unique tokens
Classes related to colours
-
palettes_colour- Colours:$\color{red}{\bullet}$ #FF0000 -
palettes_palette- Colour palettes:$\color{red}{\bullet}$ #FF0000
- Advanced R by Hadley Wickham
- vctrs: simplifies creating vector classes
- Earo Wang: A practical guide to vctrs-powered S3 programming: using vctrs for turtle graphics
- Jesse Sadler, vctrs: Creating custom vector classes with the vctrs package at RStudio::conf2020 with the companion tutorial debvctrs
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International license.
