From ggrothend|eck @end|ng |rom gm@||@com  Tue Aug 10 21:33:20 2021
From: ggrothend|eck @end|ng |rom gm@||@com (Gabor Grothendieck)
Date: Tue, 10 Aug 2021 15:33:20 -0400
Subject: [Rd] problem with pipes, textConnection and read.dcf
Message-ID: <CAP01uRn+6zWEgmyGfNTb3aJJoLCy8mbhJFj6SiWWBktmXwsncA@mail.gmail.com>

This gives an error bit if the first gsub line is commented out then there is no
error even though it is equivalent code.

  L <- c("Variable:id", "Length:112630     ")

  L |>
    gsub(pattern = " ", replacement = "") |>
    gsub(pattern = " ", replacement = "") |>
    textConnection() |>
    read.dcf()
  ## Error in textConnection(gsub(gsub(L, pattern = " ", replacement = ""),  :
  ##  argument 'object' must deparse to a single character string

That is this works:

  L |>
    # gsub(pattern = " ", replacement = "") |>
    gsub(pattern = " ", replacement = "") |>
    textConnection() |>
    read.dcf()
  ##      Variable Length
  ## [1,] "id"     "112630"

  R.version.string
  ## [1] "R version 4.1.0 RC (2021-05-16 r80303)"
  win.version()
  ## [1] "Windows 10 x64 (build 19042)"

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



[Rd] problem with pipes, textConnection and read.dcf
Gabor Grothendieck