On Tue, 30 Dec 2025, Andre Luiz Tietbohl Ramos writes:

> Hello everyone,
>
> I solved the problem! I had nothing to do with any of the aspects
> explained.  It might seem even funny to some...
> My lack of in depth knowledge about the R platform was the culprit.  I
> didn't know R kept all the workspace symbols between sessions if saved.
> Thus, there was some kind of mess with them. My apologies.
>
> The solution was very simple: rm(list = ls()).  Everything works fine just
> a before with the functions I developed originally.  In order to guarantee
> it doesn't happen again I put this command first in the startup
> configuration and in the .Last function of the .Rprofile.
>
> Regards,
>
> --
> André Luiz Tietbohl Ramos, PhD.
>


R has commandline options for not saving/restoring the
workspace; decent editors allow you to put such options into
your configuration:

   --no-save
          Don't save [workspace at the end of the session]

   --no-restore-data
          Don't restore previously saved objects

   --no-restore-history
          Don't restore the R history file

   --no-restore
          Don't restore anything


kind regards
  Enrico

>
> Em seg., 29 de dez. de 2025 às 17:58, Enrico Schumann 
> <[email protected]>
> escreveu:
>
>> On Mon, 29 Dec 2025, Andre Luiz Tietbohl Ramos writes:
>>
>> > Em seg., 29 de dez. de 2025 às 10:25, Enrico Schumann 
>> > <[email protected]>
>> > escreveu:
>> >>
>> >> Could you please post a small, reproducible example (in plain
>> >> text)?  Otherwise, it will be hard so see where your problem
>> >> lies.
>> >>
>> >>
>> >> kind regards
>> >>     Enrico
>> >>
>> >
>> > Hello,
>> >
>> > Thanks for the interest, Enrico. It is below.
>> > R> tickers
>> >  "AALR3.SA"  "AGRO3.SA"  "ALPA3.SA"  "ALPA4.SA"  "ALUP11.SA" "AMER3.SA"
>> "
>> > AMOB3.SA"  "ANIM3.SA"  "ASAI3.SA"  "AURE3.SA"  "AZUL4.SA"  "B3SA3.SA" "
>> > BAUH4.SA"  "BAZA3.SA"  "BBAS3.SA"  "BBDC4.SA"  "BBSE3.SA"  "BDLL4.SA"  "
>> > BEES3.SA"  "BIDU34.SA" "BLAU3.SA"  "BMOB3.SA"  "BPAC11.SA" "BPAN4.SA" "
>> > BRAP4.SA"  "BRFS3.SA"  "BRKM5.SA"  "BRSR6.SA"  "BRST3.SA"  "BSLI3.SA"  "
>> > CBAV3.SA"  "CEAB3.SA"  "CEBR3.SA"  "CMIG3.SA"  "CMIG4.SA"  "CMIN3.SA" "
>> > COPH34.SA" "CPFE3.SA"  "CPLE6.SA"  "CRPG5.SA"  "CSAN3.SA"  "CSED3.SA"  "
>> > CSMG3.SA"  "CSNA3.SA"  "CSUD3.SA"  "CXSE3.SA"  "CYRE3.SA"
>> > ...
>> > R>
>> > R> getSymbols(tickers, src = "yahoo", from = start, to = end, maxgap =
>> 10,
>> > auto.asign = TRUE)
>> > R>
>> > R> tickers <- mget(ls(pattern = paste(tickers, collapse = "|")))
>> > R>
>> > R> names(tickers)
>> >   [1] "AALR3.SA"              "AFHI11.SA"             "AGRO3.SA"
>> >    "ALPA3.SA"              "ALPA4.SA"              "ALUP11.SA"
>> >   [7] "AMER3.SA"              "AMOB3.SA"              "ANIM3.SA"
>> >    "ASAI3.SA"              "AURE3.SA"              "AZUL4.SA"
>> >  [13] "B3SA3.SA"              "BAUH4.SA"              "BAZA3.SA"
>> >    *"BBAS3.SA <http://BBAS3.SA>"              "BBAS3.SA_log_returns"
>> >  "BBAS3.SA_mean_log"   *
>> >  [19] "BBAS3.SA_sd_log"       "BBDC4.SA"              "BBSE3.SA"
>> >  "BBSE3.SA_log_returns"  "BBSE3.SA_mean_log"     "BBSE3.SA_sd_log"
>> >  [25] "BDLL4.SA"              "BEES3.SA"              "BIDU34.SA"
>> >   "BLAU3.SA"              "BMOB3.SA"              "BPAC11.SA"
>> >  [31] "BPAN4.SA"              "BRAP4.SA"              "BRFS3.SA"
>> >    "BRKM5.SA"              "BRSR6.SA"              "BRST3.SA"
>> > ...
>> > R> class(tickers$BBAS3.SA)
>> > [1] "xts" "zoo"
>> > R> colnames(tickers$BBAS3.SA)
>> > [1] "BBAS3.SA.Open"     "BBAS3.SA.High"     "BBAS3.SA.Low"
>> >  "BBAS3.SA.Close"    "BBAS3.SA.Volume"   "BBAS3.SA.Adjusted"
>> > R> class(tickers$BBAS3.SA_log_returns)
>> > [1] "xts" "zoo"
>> > R>  colnames(tickers$BBAS3.SA_log_returns)
>> > [1] "daily.returns"
>> > R> class(tickers$BBAS3.SA_mean_log)
>> > [1] "numeric"
>> > R> R> colnames(tickers$BBAS3.SA_mean_log)
>> > NULL  (as expected)
>> > R>
>> >
>> > Therefore the list I get from the mget operation above contains several
>> > elements with different types, which may include even _sd_ columns as
>> well.
>> > My objective is to get rid of the .SA suffix used for Brazilian stocks in
>> > all elements downloaded as well as their columns.  I chose to put
>> > everything in a list and operate on it.
>> >
>>
>> [...]
>>
>> Like Eric, I cannot reproduce your result. In addition
>> to Dirk's suggestions for debugging:
>>
>>  i) start from a clean session (no workspace-loading);
>>
>> ii) since your column 'tickers$BBAS3.SA_log_returns' is named
>>     "daily.returns" -- any chance you are (accidentally) calling
>>     'quantmod::dailyReturn' in your code?
>>
>> --
>> Enrico Schumann
>> Lucerne, Switzerland
>> https://enricoschumann.net

-- 
Enrico Schumann
Lucerne, Switzerland
https://enricoschumann.net

_______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.

Reply via email to