[R-SIG-Finance] as.journal returns subscript out of bounds

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Fri Apr 11 14:40:35 CEST 2025


On 11 April 2025 at 14:16, Arnaud Gaboury wrote:
| I can't see any reason why the command returns an error.

It does not error for me:

  > class(btc_op)
  [1] "tbl_df"     "tbl"        "data.frame"
  > class(as.journal(btc_op))
  [1] "journal"
  > head(as.journal(btc_op))
     instrument            timestamp    amount     price
  1     BTCUSDC  2024-12-16 12:10:00   9.33721  107012.0
  2     BTCUSDC  2024-12-17 03:01:30   0.04811  107358.8
  3     BTCUSDC  2024-12-18 14:32:53   0.12324  101422.9
  4     BTCUSDC  2025-01-02 03:33:18  -0.06504   96408.2
  5     BTCUSDC  2025-01-02 04:15:12   0.96557   96606.1
  6     BTCUSDC  2025-01-14 05:34:28   2.42992   96526.3
  
  6 transactions  
  > 

So maybe your local setup is borked. I am 'CRAN-current' here and used the
`structure()` command you posted.

You may want to learn about traceback(), and things like browser(), to debug
functions.  It's all open source so you can play with it.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-SIG-Finance mailing list