Movatterモバイル変換


[0]ホーム

URL:


Column types

library(tibble)

Overview

This vignette shows an overview of known data types and theirabbreviations, and their origin. For example,<int>in the header of a column indicates an integer column, and<chr> denotes a character column.

ClassData typeExampleColumn header
AtomiclogicalTRUElgl
integer1Lint
double1.5dbl
character"A"chr
complex0+1icpl
rawas.raw(1)raw
listlist(1)list
named listlist(a = 1)named list
Built-in objectsfactorfactor("A")fct
orderedordered("a")ord
DateSys.Date()date
POSIXtSys.time()dttm
difftimevctrs::new_duration(1)drtn
Objects from other packageshmshms::hms(1)time
integer64bit64::as.integer64(1e+10)int64
blobblob::blob(raw(1))blob
Data framesdata.framedata.frame(a = 1)df[,1]
tbl_dftibble(a = 1)tibble[,1]
UnchangedAsIsI(1L)I
vctrs typesunspecifiedvctrs::unspecified(1)???
vctrs_list_ofvctrs::list_of(c(1L))list
vctrs_vctrvctrs::new_vctr(1L)vctrs_vc
vctrs_partial_factorvctrs::partial_factor(letters)prtl_fctr
vctrs_partial_framevctrs::partial_frame(a = 1)prtl
Language objectsfunctionfunction() NULLfn
symbolquote(a)sym
expressionparse(text = "a <- 1\nb<- 2")expression
quosuresrlang::quos(a = 1)quos

Example values

The following overview contains example values for each type:

#> Rows: 1#> Columns: 23#> $ logical       <lgl> TRUE#> $ integer       <int> 1#> $ double        <dbl> 1.5#> $ character     <chr> "A"#> $ complex       <cpl> 0+1i#> $ raw           <raw> 01#> $ list          <list> 1#> $ `named list`  <named list> 1#> $ factor        <fct> A#> $ ordered       <ord> a#> $ Date          <date> 2025-06-07#> $ POSIXt        <dttm> 2025-06-07 10:54:32#> $ difftime      <drtn> 1 secs#> $ hms           <time> 00:00:01#> $ integer64     <int64> 10000000000#> $ blob          <blob> 00#> $ data.frame    <df[,1]> <data.frame[1 x 1]>#> $ tbl_df        <tibble[,1]> <tbl_df[1 x 1]>#> $ AsIs          <I<int>> 1#> $ unspecified   <???> NA#> $ vctrs_list_of <list<int>> 1#> $ vctrs_vctr    <vctrs_vc> 1#> $ quosures      <quos> <~1>

Implementation

The column header is obtained by callingpillar::type_sum() on the column. This is an S3 method thatcan be overridden, but most of the time it is more useful to overridevctrs::vec_ptype_abbr():

pillar:::type_sum.default#> function (x)#> {#>     pillar_attr <- attr(x, "pillar", exact = TRUE)#>     label <- pillar_attr$label#>     if (!is.null(label)) {#>         return(I(label))#>     }#>     if (is.object(x) || vec_is(x)) {#>         return(vec_ptype_abbr(x))#>     }#>     switch(typeof(x), builtin = , special = , closure = "fn",#>         environment = "env", symbol = if (is_missing(x)) {#>             "missing"#>         } else {#>             "sym"#>         }, typeof(x))#> }#> <bytecode: 0x12ab321f0>#> <environment: namespace:pillar>

[8]ページ先頭

©2009-2025 Movatter.jp