Displaying 2 results from an estimated 2 matches for "as_tibble_col".
2023 Oct 17
1
transform a list of arrays to tibble
...e will not be supporting row names and you may want to simply save those names in an additional column or externally.
My first thought was to simply save the names you need and then put them back on the tibble. In your code, something like this:
save.names <- names(my.ret.lst)
result.tib <- as_tibble_col(unlist(my.ret.lst), column_name = 'return')
rownames(result.tib) <- save.names
Unfortunately, I got an error message:
> save.names
[1] "BTCUSDT" "ETHUSDT" "TRXUSDT"
> rownames(result.tib) <- save.names
Warning message:
Setting row names on a tibbl...
2023 Oct 17
1
transform a list of arrays to tibble
...c(1L,
1L), dimnames = list("Annualized Return", NULL)))
Now I can't find how to build a tibble in a specific format (asset
names as row names and observations as column names) .
I can of course run:
> mytb <- as_tibble(unlist(my.ret.lst)
but I loose row and column names.
> as_tibble_col(unlist(my.ret.lst), column_name = 'return')
will give me the wanted column name but row names (in my case asset
names) are missing.
Thank you for help