Here is my tibble:
btc_op <- structure(list(timestamp = structure(c(1734372600,
1734426090.135,
1734553973.032, 1735810398.277, 1735812912.427, 1736854468.083,
1736865119.74, 1736865312.915, 1736865453.951, 1736974766.64,
1736975211.156, 1736975380.095, 1737041368.809, 1737625581.878,
1737969957.279, 1737982296.161, 1737983492.087, 1737989818.863,
1737990022.153, 1738058503.483, 1738076112.736, 1738157206.539,
1738161507.243, 1738163335.254, 1738171799.704, 1738769416.056,
1738856868.753, 1738936692.68, 1738937334.883, 1739379482.659,
1739446986.289, 1739979238.947, 1739996323.332, 1740491373.055,
1740667962.173, 1740768770.074, 1740768953.683, 1740786989.548,
1741012632.874, 1741283872.186, 1741295693.088, 1741342541.164,
1741629884.419, 1741635304.779, 1741685200.989, 1741686554.221,
1741698998.622, 1741707118.96, 1741802675.392, 1742325681.41,
1742378556.512, 1742398685.416, 1742404126.746, 1743000224.05,
1743011323.324, 1743408729.623, 1743425658.334, 1743428419.647,
1743429808.131, 1743430795.489, 1743431687.034, 1743439548.713,
1743440894.393, 1743445384.52, 1743495501.973, 1743504926.243,
1743519851.83, 1743520420.807, 1743530499.577, 1743531476.483,
1743546009.677, 1743584674.851, 1743585101.461, 1743601492.33,
1743601850.895, 1743679321.994, 1743780565.767, 1743785970.297
), tzone = "UTC", class = c("POSIXct", "POSIXt")), amount =
c(9.3372107,
0.04811, 0.12324, -0.06504, 0.96557, 2.42992, 2.42014, 4.78121,
0.04825, 0.29346, -0.001, -0.01505, -0.125, 1.20446, -1.76856,
-1.73956, -1.71811, -0.72513, -0.98166, 4.72757, 4.73485, -1.7,
-1.7, 8.98573, -0.70622, 0.84257, -3.50343, 6.34343, -0.45516,
0.26061, 0.254, -0.36895, 0.75773, -2.69675, 0.58439, 2.06429,
-2.06429, 2.07134, -6.12345, -3.09273, 3.09273, 1.54911, 2.54393,
2, 1.52842, 1.48698, 1.36813, -0.01848, 0.42519, -3, -0.01435,
2.82199, 1.40107, -0.07286, 0.4878, 5.78271, -3.37969, -3.41518,
6.7704, -6.75106, 6.71609, -6.72629, 6.71421, -6.7396, 6.6851,
-6.74, 6.717, -0.17957, -6.59629, -3.30205, 10.01426, -0.03538,
-6.5872, 6.56085, -6.56, -6.56, 7, 7.40359), price = c(107012,
107358.81, 101422.93, 96408.23, 96606.12, 96526.3, 96916.53115,
97133.32, 97228.23, 99651.73, 99519.61, 99663.37, 98394.97,
101941.107914,
98950.008481, 100600, 101335.283692, 102050, 101868.208951, 102900,
102741.596027, 101846.9, 101845.270978, 102368.611214, 102384.062461,
98487.23, 97076.26334, 98853.757704, 99403.962752, 96870.45,
96050, 96382, 96426.612765, 88900, 85558.02, 84977.109628,
84683.133951,
84394.870663, 92227.890836, 88418.629504, 89720.689866, 88856.101525,
78618.406955, 79413.144936, 81500, 80700, 80000, 81125.99, 81928.04,
82025.99514, 83618, 84392.65, 84686.879799, 86605.99, 86100,
82214.102411, 82936.397434, 82074.529897, 82801.529337, 83038.750762,
83471.184268, 83344.568664, 83494.401651, 83179.906336, 83857.962478,
84146.764724, 84460.185312, 84642.9, 84987.11819, 84795.687321,
85376.758785, 84783.59, 85104.418136, 85446.292013, 85867.737502,
83126.156483, 83255.75794, 83355.928936), instrument = c("BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC",
"BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC", "BTCUSDC")), row.names =
c(NA,
-78L), class = c("tbl_df", "tbl", "data.frame"))
str(btc_op)
tibble [78 ? 4] (S3: tbl_df/tbl/data.frame)
$ timestamp : POSIXct[1:78], format: "2024-12-16 18:10:00" "2024-12-17
09:01:30" "2024-12-18 20:32:53" "2025-01-02 09:33:18" ...
$ amount : num [1:78] 9.3372 0.0481 0.1232 -0.065 0.9656 ...
$ price : num [1:78] 107012 107359 101423 96408 96606 ...
$ instrument: chr [1:78] "BTCUSDC" "BTCUSDC" "BTCUSDC" "BTCUSDC" ...
btc_journal <- as.journal(btc_op)
Error in names[[i]] : subscript out of bounds
I can't see any reason why the command returns an error.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20250411/7354424c/attachment.sig>
as.journal returns subscript out of bounds
7 messages · Arnaud Gaboury, Dirk Eddelbuettel, Enrico Schumann
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 at debian.org
On Fri, 2025-04-11 at 07:40 -0500, Dirk Eddelbuettel wrote:
After a few tests, it looks my my environment is broken. Will clean and build again my data frames from start.
n 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
-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20250411/7ca5e093/attachment.sig>
Even in a new empty environment, anf after a rebuild of ally my data frames which bring me to the final ones, I still get this error: gabx at magnolia [R] btc_journal <- as.journal(btc_op) gabx at magnolia [R] View(btc_journal) Error in names[[i]] : subscript out of bounds gabx at magnolia [R] str(btc_journal) ?journal?: 78 transactions $ instrument: chr [1:78] "BTCUSDC" "BTCUSDC" "BTCUSDC" "BTCUSDC" ... $ timestamp : POSIXct[1:78], format: "2024-12-16 18:10:00" "2024-12-17 09:01:30" "2024-12-18 20:32:53" "2025-01-02 09:33:18" ... $ amount : num [1:78] 9.3372 0.0481 0.1232 -0.065 0.9656 ... $ price : num [1:78] 107012 107359 101423 96408 96606 ... I am afraid I must learn to use traceback() as I can't see any obvious reasons for the error.
On Fri, 2025-04-11 at 07:40 -0500, Dirk Eddelbuettel wrote:
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
-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20250411/d51ff270/attachment.sig>
On Fri, 11 Apr 2025, Arnaud Gaboury writes:
Even in a new empty environment, anf after a rebuild of ally my data frames which bring me to the final ones, I still get this error: gabx at magnolia [R] btc_journal <- as.journal(btc_op) gabx at magnolia [R] View(btc_journal) Error in names[[i]] : subscript out of bounds gabx at magnolia [R] str(btc_journal) ?journal?: 78 transactions $ instrument: chr [1:78] "BTCUSDC" "BTCUSDC" "BTCUSDC" "BTCUSDC" ... $ timestamp : POSIXct[1:78], format: "2024-12-16 18:10:00" "2024-12-17 09:01:30" "2024-12-18 20:32:53" "2025-01-02 09:33:18" ... $ amount : num [1:78] 9.3372 0.0481 0.1232 -0.065 0.9656 ... $ price : num [1:78] 107012 107359 101423 96408 96606 ... I am afraid I must learn to use traceback() as I can't see any obvious reasons for the error.
I cannot reproduce with recent Rs on GNU/Linux.
But I _can_ reproduce it on Windows with RStudio. And
the error is not thrown by `as.journal`, but when I try
to call `View`. Which is RStudio's own variant of the
function. What happens when you say
utils::View(btc_journal)
?
Enrico
On Fri, 2025-04-11 at 07:40 -0500, Dirk Eddelbuettel wrote:
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
Enrico Schumann Lucerne, Switzerland https://enricoschumann.net
On Fri, 2025-04-11 at 19:33 +0200, Enrico Schumann wrote:
I was just writing the same observation: it is when I run view(). gabx at magnolia [R] short_j <- journal( ... timestamp = short$value, ... amount = short$executed_qty, ... price = short$price, ... instrument = short$symbol ... ) gabx at magnolia [R] View(short_j) Error in names[[i]] : subscript out of bounds As you can see, I can build the short_j journal with no error, but it is when I want to view it. I use Rstudio on Archlinux. When running? R > utils::View(btc_journal) a pop up window open with the journal in a correct view. So there is something wrong with Rstudio ? Or any package of my linux distro?
On Fri, 11 Apr 2025, Arnaud Gaboury writes:
Even in a new empty environment, anf after a rebuild of ally my data frames which bring me to the final ones, I still get this error: gabx at magnolia [R] btc_journal <- as.journal(btc_op) gabx at magnolia [R] View(btc_journal) Error in names[[i]] : subscript out of bounds gabx at magnolia [R] str(btc_journal) ?journal?: 78 transactions ?$ instrument: chr [1:78] "BTCUSDC" "BTCUSDC" "BTCUSDC" "BTCUSDC" ... ?$ timestamp : POSIXct[1:78], format: "2024-12-16 18:10:00" "2024- 12-17 09:01:30" "2024-12-18 20:32:53" "2025-01-02 09:33:18" ... ?$ amount??? : num [1:78] 9.3372 0.0481 0.1232 -0.065 0.9656 ... ?$ price???? : num [1:78] 107012 107359 101423 96408 96606 ... I am afraid I must learn to use traceback() as I can't see any obvious reasons for the error.
I cannot reproduce with recent Rs on GNU/Linux. But I _can_ reproduce it on Windows with RStudio. And the error is not thrown by `as.journal`, but when I try to call `View`.? Which is RStudio's own variant of the function.? What happens when you say ??? utils::View(btc_journal) ? ??? Enrico
On Fri, 2025-04-11 at 07:40 -0500, Dirk Eddelbuettel wrote:
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
-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20250411/a749c305/attachment.sig>
On Fri, 11 Apr 2025, Arnaud Gaboury writes:
On Fri, 2025-04-11 at 19:33 +0200, Enrico Schumann wrote: I was just writing the same observation: it is when I run view(). gabx at magnolia [R] short_j <- journal( ... timestamp = short$value, ... amount = short$executed_qty, ... price = short$price, ... instrument = short$symbol ... ) gabx at magnolia [R] View(short_j) Error in names[[i]] : subscript out of bounds As you can see, I can build the short_j journal with no error, but it is when I want to view it. I use Rstudio on Archlinux. When running? R > utils::View(btc_journal) a pop up window open with the journal in a correct view. So there is something wrong with Rstudio ? Or any package of my linux distro?
I'd go with "It happens with RStudio". I am not sure View is supposed to support journals or other non-base datatypes. But ?utils::View (i.e. the 'real' View) says that utils::View coerces to data.frame, and since there is an as.data.frame method for journals, it just works. [...]
Enrico Schumann Lucerne, Switzerland https://enricoschumann.net