当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R readr read_delim 将分隔文件(包括 CSV 和 TSV)读入 tibble


read_csv()read_tsv() 是更通用的 read_delim() 的特殊情况。它们对于读取最常见类型的平面文件数据、逗号分隔值和制表符分隔值非常有用。 read_csv2() 使用 ; 作为字段分隔符,使用 , 作为小数点。这种格式在一些欧洲国家很常见。

用法

read_delim(
  file,
  delim = NULL,
  quote = "\"",
  escape_backslash = FALSE,
  escape_double = TRUE,
  col_names = TRUE,
  col_types = NULL,
  col_select = NULL,
  id = NULL,
  locale = default_locale(),
  na = c("", "NA"),
  quoted_na = TRUE,
  comment = "",
  trim_ws = FALSE,
  skip = 0,
  n_max = Inf,
  guess_max = min(1000, n_max),
  name_repair = "unique",
  num_threads = readr_threads(),
  progress = show_progress(),
  show_col_types = should_show_types(),
  skip_empty_rows = TRUE,
  lazy = should_read_lazy()
)

read_csv(
  file,
  col_names = TRUE,
  col_types = NULL,
  col_select = NULL,
  id = NULL,
  locale = default_locale(),
  na = c("", "NA"),
  quoted_na = TRUE,
  quote = "\"",
  comment = "",
  trim_ws = TRUE,
  skip = 0,
  n_max = Inf,
  guess_max = min(1000, n_max),
  name_repair = "unique",
  num_threads = readr_threads(),
  progress = show_progress(),
  show_col_types = should_show_types(),
  skip_empty_rows = TRUE,
  lazy = should_read_lazy()
)

read_csv2(
  file,
  col_names = TRUE,
  col_types = NULL,
  col_select = NULL,
  id = NULL,
  locale = default_locale(),
  na = c("", "NA"),
  quoted_na = TRUE,
  quote = "\"",
  comment = "",
  trim_ws = TRUE,
  skip = 0,
  n_max = Inf,
  guess_max = min(1000, n_max),
  progress = show_progress(),
  name_repair = "unique",
  num_threads = readr_threads(),
  show_col_types = should_show_types(),
  skip_empty_rows = TRUE,
  lazy = should_read_lazy()
)

read_tsv(
  file,
  col_names = TRUE,
  col_types = NULL,
  col_select = NULL,
  id = NULL,
  locale = default_locale(),
  na = c("", "NA"),
  quoted_na = TRUE,
  quote = "\"",
  comment = "",
  trim_ws = TRUE,
  skip = 0,
  n_max = Inf,
  guess_max = min(1000, n_max),
  progress = show_progress(),
  name_repair = "unique",
  num_threads = readr_threads(),
  show_col_types = should_show_types(),
  skip_empty_rows = TRUE,
  lazy = should_read_lazy()
)

参数

file

文件路径、连接或文字数据(单个字符串或原始向量)。

.gz.bz2.xz.zip 结尾的文件将自动解压缩。将自动下载以 http://https://ftp://ftps:// 开头的文件。远程gz文件也可以自动下载并解压。

文字数据对于示例和测试最有用。要被识别为文字数据,输入必须用 I() 包装,是包含至少一个换行符的字符串,或者是至少包含一个带有换行符的字符串的向量。

使用值 clipboard() 将从系统剪贴板读取。

delim

用于分隔记录中的字段的单个字符。

quote

用于引用字符串的单个字符。

escape_backslash

文件是否使用反斜杠来转义特殊字符?这比 escape_double 更通用,因为反斜杠可用于转义分隔符、引号字符,或添加特殊字符,例如 \\n

escape_double

文件是否通过加倍引号来转义引号?即,如果此选项为 TRUE ,则值 """" 表示单引号 \"

col_names

TRUEFALSE 或列名称的字符向量。

如果 TRUE ,输入的第一行将用作列名称,并且不会包含在 DataFrame 中。如果 FALSE ,将自动生成列名称:X1、X2、X3 等。

如果 col_names 是字符向量,则这些值将用作列的名称,并且输入的第一行将被读入输出数据帧的第一行。

缺少 ( NA ) 列名将生成警告,并用虚拟名称 ...1...2 等进行填充。重复的列名将生成警告并使其唯一,请参阅 name_repair 来控制其方式完毕。

col_types

NULLcols() 规范或字符串之一。有关更多详细信息,请参阅vignette("readr")

如果是 NULL ,则所有列类型都将从输入的 guess_max 行推断出来,散布在整个文件中。这很方便(而且快速),但不够稳健。如果猜测的类型错误,您需要增加 guess_max 或自己提供正确的类型。

list()cols() 创建的列规范必须为每一列包含一个列规范。如果您只想读取列的子集,请使用 cols_only()

或者,您可以使用紧凑的字符串表示形式,其中每个字符代表一列:

  • c = 字符

  • 我 = 整数

  • n = 数字

  • d = 双

  • l = 逻辑

  • f = 因子

  • D = 日期

  • T = 日期时间

  • t = 时间

  • ? = 猜猜

  • _ 或 - = 跳过

默认情况下,读取没有列规范的文件将打印一条消息,显示 readr 猜测的内容。要删除此消息,请设置 show_col_types = FALSE 或设置 `options(readr.show_col_types = FALSE)。

col_select

要包含在结果中的列。您可以使用与dplyr::select() 相同的mini-language 来按名称引用列。使用c() 可以使用多个选择表达式。尽管这种用法不太常见,col_select 也接受数字列索引。有关选择语言的完整详细信息,请参阅?tidyselect::language

id

用于存储文件路径的列的名称。当读取多个输入文件并且文件路径中有数据(例如数据收集日期)时,这非常有用。如果NULL(默认值)则不会创建额外的列。

locale

区域设置控制默认值因地而异。默认区域设置为 US-centric(如 R),但您可以使用 locale() 创建自己的区域设置来控制默认时区、编码、小数标记、大标记和日/月名称等内容。

na

要解释为缺失值的字符串的字符向量。将此选项设置为 character() 以指示没有缺失值。

quoted_na

引号内的缺失值是否应被视为缺失值(默认)或字符串。从 readr 2.0.0 开始,此参数已被软弃用。

comment

用于标识评论的字符串。注释字符之后的任何文本都将被默默忽略。

trim_ws

在解析每个字段之前是否应该删除前导和尾随空格(ASCII 空格和制表符)?

skip

读取数据之前要跳过的行数。如果提供comment,则跳过后任何注释行都将被忽略。

n_max

读取的最大行数。

guess_max

用于猜测列类型的最大行数。永远不会使用超过读取的行数。有关更多详细信息,请参阅vignette("column-types", package = "readr")

name_repair

列名的处理。默认行为是确保列名称为 "unique" 。支持多种修复策略:

  • "minimal":除了名称的基本存在之外,没有名称修复或检查。

  • "unique"(默认值):确保名称唯一且不为空。

  • "check_unique" :没有名称修复,但检查它们是 unique

  • "universal" :将名称命名为 unique 并进行语法设置。

  • 函数:应用自定义名称修复(例如,name_repair = make.names 用于基本 R 样式的名称)。

  • purrr-style 匿名函数,请参阅rlang::as_function()

此参数作为 repair 传递到 vctrs::vec_as_names() 。有关这些条款以及用于执行这些条款的策略的更多详细信息,请参阅此处。

num_threads

用于初始解析和延迟读取数据的处理线程数。如果您的数据在字段中包含换行符,解析器应自动检测到这一点并回退到仅使用一个线程。但是,如果您知道文件在带引号的字段中包含换行符,那么显式设置 num_threads = 1 是最安全的。

progress

显示进度条?默认情况下,它只会在交互式会话中显示,而不会在编织文档时显示。可以通过将选项 readr.show_progress 设置为 FALSE 来禁用自动进度条。

show_col_types

如果是 FALSE ,则不显示猜测的列类型。如果 TRUE 始终显示列类型,即使提供了列类型。如果 NULL(默认)仅在 col_types 参数未显式提供列类型时显示列类型。

skip_empty_rows

空白行应该被完全忽略吗?即,如果此选项是TRUE,则根本不会表示空白行。如果是FALSE,则它们将由所有列中的NA 值表示。

lazy

懒惰地读取值?默认情况下,这是 FALSE ,因为延迟读取文件时有一些特殊的考虑因子,这导致了一些用户的错误。具体来说,读取然后写回同一个文件时,事情会变得很棘手。但是,一般来说,惰性读取 ( lazy = TRUE ) 有很多好处,特别是对于交互式使用以及当您的下游工作仅涉及行或列的子集时。

should_read_lazy()vroom::vroom()altrep 参数的文档中了解更多信息。

一个tibble()。如果存在解析问题,则会出现警告提醒您。您可以通过在数据集上调用 problems() 来检索完整的详细信息。

例子

# Input sources -------------------------------------------------------------
# Read from a path
read_csv(readr_example("mtcars.csv"))
#> Rows: 32 Columns: 11
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 32 × 11
#>      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4
#>  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4
#>  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
#>  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
#>  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
#>  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
#>  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
#>  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2
#>  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
#> 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
#> # … with 22 more rows
read_csv(readr_example("mtcars.csv.zip"))
#> Rows: 32 Columns: 11
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 32 × 11
#>      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4
#>  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4
#>  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
#>  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
#>  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
#>  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
#>  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
#>  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2
#>  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
#> 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
#> # … with 22 more rows
read_csv(readr_example("mtcars.csv.bz2"))
#> Rows: 32 Columns: 11
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 32 × 11
#>      mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
#>    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  21       6  160    110  3.9   2.62  16.5     0     1     4     4
#>  2  21       6  160    110  3.9   2.88  17.0     0     1     4     4
#>  3  22.8     4  108     93  3.85  2.32  18.6     1     1     4     1
#>  4  21.4     6  258    110  3.08  3.22  19.4     1     0     3     1
#>  5  18.7     8  360    175  3.15  3.44  17.0     0     0     3     2
#>  6  18.1     6  225    105  2.76  3.46  20.2     1     0     3     1
#>  7  14.3     8  360    245  3.21  3.57  15.8     0     0     3     4
#>  8  24.4     4  147.    62  3.69  3.19  20       1     0     4     2
#>  9  22.8     4  141.    95  3.92  3.15  22.9     1     0     4     2
#> 10  19.2     6  168.   123  3.92  3.44  18.3     1     0     4     4
#> # … with 22 more rows
if (FALSE) {
# Including remote paths
read_csv("https://github.com/tidyverse/readr/raw/main/inst/extdata/mtcars.csv")
}

# Read from multiple file paths at once
continents <- c("africa", "americas", "asia", "europe", "oceania")
filepaths <- vapply(
  paste0("mini-gapminder-", continents, ".csv"),
  FUN = readr_example,
  FUN.VALUE = character(1)
)
read_csv(filepaths, id = "file")
#> Rows: 26 Columns: 6
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): country
#> dbl (4): year, lifeExp, pop, gdpPercap
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 26 × 6
#>    file                               country  year lifeExp    pop gdpPe…¹
#>    <chr>                              <chr>   <dbl>   <dbl>  <dbl>   <dbl>
#>  1 /home/runner/work/_temp/Library/r… Algeria  1952    43.1 9.28e6   2449.
#>  2 /home/runner/work/_temp/Library/r… Angola   1952    30.0 4.23e6   3521.
#>  3 /home/runner/work/_temp/Library/r… Benin    1952    38.2 1.74e6   1063.
#>  4 /home/runner/work/_temp/Library/r… Botswa…  1952    47.6 4.42e5    851.
#>  5 /home/runner/work/_temp/Library/r… Burkin…  1952    32.0 4.47e6    543.
#>  6 /home/runner/work/_temp/Library/r… Burundi  1952    39.0 2.45e6    339.
#>  7 /home/runner/work/_temp/Library/r… Argent…  1952    62.5 1.79e7   5911.
#>  8 /home/runner/work/_temp/Library/r… Bolivia  1952    40.4 2.88e6   2677.
#>  9 /home/runner/work/_temp/Library/r… Brazil   1952    50.9 5.66e7   2109.
#> 10 /home/runner/work/_temp/Library/r… Canada   1952    68.8 1.48e7  11367.
#> # … with 16 more rows, and abbreviated variable name ¹gdpPercap

# Or directly from a string with `I()`
read_csv(I("x,y\n1,2\n3,4"))
#> Rows: 2 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): x, y
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 2 × 2
#>       x     y
#>   <dbl> <dbl>
#> 1     1     2
#> 2     3     4

# Column selection-----------------------------------------------------------
# Pass column names or indexes directly to select them
read_csv(readr_example("chickens.csv"), col_select = c(chicken, eggs_laid))
#> Rows: 5 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): chicken
#> dbl (1): eggs_laid
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 5 × 2
#>   chicken                 eggs_laid
#>   <chr>                       <dbl>
#> 1 Foghorn Leghorn                 0
#> 2 Chicken Little                  3
#> 3 Ginger                         12
#> 4 Camilla the Chicken             7
#> 5 Ernie The Giant Chicken         0
read_csv(readr_example("chickens.csv"), col_select = c(1, 3:4))
#> Rows: 5 Columns: 3
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): chicken, motto
#> dbl (1): eggs_laid
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 5 × 3
#>   chicken                 eggs_laid motto                                 
#>   <chr>                       <dbl> <chr>                                 
#> 1 Foghorn Leghorn                 0 That's a joke, ah say, that's a joke,…
#> 2 Chicken Little                  3 The sky is falling!                   
#> 3 Ginger                         12 Listen. We'll either die free chicken…
#> 4 Camilla the Chicken             7 Bawk, buck, ba-gawk.                  
#> 5 Ernie The Giant Chicken         0 Put Captain Solo in the cargo hold.   

# Or use the selection helpers
read_csv(
  readr_example("chickens.csv"),
  col_select = c(starts_with("c"), last_col())
)
#> Rows: 5 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> chr (2): chicken, motto
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 5 × 2
#>   chicken                 motto                                           
#>   <chr>                   <chr>                                           
#> 1 Foghorn Leghorn         That's a joke, ah say, that's a joke, son.      
#> 2 Chicken Little          The sky is falling!                             
#> 3 Ginger                  Listen. We'll either die free chickens or we di…
#> 4 Camilla the Chicken     Bawk, buck, ba-gawk.                            
#> 5 Ernie The Giant Chicken Put Captain Solo in the cargo hold.             

# You can also rename specific columns
read_csv(
  readr_example("chickens.csv"),
  col_select = c(egg_yield = eggs_laid, everything())
)
#> Rows: 5 Columns: 4
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> chr (3): chicken, sex, motto
#> dbl (1): eggs_laid
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 5 × 4
#>   egg_yield chicken                 sex     motto                         
#>       <dbl> <chr>                   <chr>   <chr>                         
#> 1         0 Foghorn Leghorn         rooster That's a joke, ah say, that's…
#> 2         3 Chicken Little          hen     The sky is falling!           
#> 3        12 Ginger                  hen     Listen. We'll either die free…
#> 4         7 Camilla the Chicken     hen     Bawk, buck, ba-gawk.          
#> 5         0 Ernie The Giant Chicken rooster Put Captain Solo in the cargo…

# Column types --------------------------------------------------------------
# By default, readr guesses the columns types, looking at `guess_max` rows.
# You can override with a compact specification:
read_csv(I("x,y\n1,2\n3,4"), col_types = "dc")
#> # A tibble: 2 × 2
#>       x y    
#>   <dbl> <chr>
#> 1     1 2    
#> 2     3 4    

# Or with a list of column types:
read_csv(I("x,y\n1,2\n3,4"), col_types = list(col_double(), col_character()))
#> # A tibble: 2 × 2
#>       x y    
#>   <dbl> <chr>
#> 1     1 2    
#> 2     3 4    

# If there are parsing problems, you get a warning, and can extract
# more details with problems()
y <- read_csv(I("x\n1\n2\nb"), col_types = list(col_double()))
#> Warning: One or more parsing issues, call `problems()` on your data frame for
#> details, e.g.:
#>   dat <- vroom(...)
#>   problems(dat)
y
#> # A tibble: 3 × 1
#>       x
#>   <dbl>
#> 1     1
#> 2     2
#> 3    NA
problems(y)
#> # A tibble: 1 × 5
#>     row   col expected actual file                            
#>   <int> <int> <chr>    <chr>  <chr>                           
#> 1     4     1 a double b      /tmp/RtmpwhXCeJ/file16952e55c60b

# Column names --------------------------------------------------------------
# By default, readr duplicate name repair is noisy
read_csv(I("x,x\n1,2\n3,4"))
#> New names:
#> • `x` -> `x...1`
#> • `x` -> `x...2`
#> Rows: 2 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): x...1, x...2
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 2 × 2
#>   x...1 x...2
#>   <dbl> <dbl>
#> 1     1     2
#> 2     3     4

# To quiet, set the option that controls verbosity of name repair
withr::with_options(
  list(rlib_name_repair_verbosity = "quiet"),
  read_csv(I("x,x\n1,2\n3,4"))
)
#> Rows: 2 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): x...1, x...2
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 2 × 2
#>   x...1 x...2
#>   <dbl> <dbl>
#> 1     1     2
#> 2     3     4

# Or use "minimal" to turn off name repair
read_csv(I("x,x\n1,2\n3,4"), name_repair = "minimal")
#> Rows: 2 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): x, x
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 2 × 2
#>       x     x
#>   <dbl> <dbl>
#> 1     1     2
#> 2     3     4

# File types ----------------------------------------------------------------
read_csv(I("a,b\n1.0,2.0"))
#> Rows: 1 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ","
#> dbl (2): a, b
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 1 × 2
#>       a     b
#>   <dbl> <dbl>
#> 1     1     2
read_csv2(I("a;b\n1,0;2,0"))
#> ℹ Using "','" as decimal and "'.'" as grouping mark. Use `read_delim()` for more control.
#> Rows: 1 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: ";"
#> dbl (2): a, b
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 1 × 2
#>       a     b
#>   <dbl> <dbl>
#> 1     1     2
read_tsv(I("a\tb\n1.0\t2.0"))
#> Rows: 1 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: "\t"
#> dbl (2): a, b
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 1 × 2
#>       a     b
#>   <dbl> <dbl>
#> 1     1     2
read_delim(I("a|b\n1.0|2.0"), delim = "|")
#> Rows: 1 Columns: 2
#> ── Column specification ──────────────────────────────────────────────────
#> Delimiter: "|"
#> dbl (2): a, b
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 1 × 2
#>       a     b
#>   <dbl> <dbl>
#> 1     1     2
源代码:R/read_delim.R

相关用法


注:本文由纯净天空筛选整理自Hadley Wickham等大神的英文原创作品 Read a delimited file (including CSV and TSV) into a tibble。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。