1

I am currently writing a code to download timeseries (which will then be converted into csv-files) to conduct an event study upon.

The following code (part of the complete code) I wrote:

 tickers = c("^AEX", "^ATX", "^BFX", "^FCHI", "^FTSE", "^GDAXI", "^IBEX", "^OMX","^OMXH25", "^OSEAX", "^SSMI", "FTSEMIB.MI")

Aggregate <- getSymbols(tickers,
                    from = "2014-01-01",
                    to = "2021-12-31")
na.omit(Aggregate,"iz",interp="linear")
Ticker <- Aggregate
Ticker
class(Ticker)
data1 <-as.data.frame(Ticker)
data1
class(data1)
data2 <- data1                    # Duplicate data frame
data2                             # Print new data frame

AEX <- ^AEX

write.zoo(AEX,"//Users/TEST/Library/CloudStorage/OneDrive-Personal/Event Study Basis\\AEX.csv",index.name="Date",sep=",")    

As the tickers of the indices (^AEX, ^ATX etc.) all possess a "^", which Excel doesn't "eat" I want to make sure the dataframe I want to export to a .csv file does not possess this "^". For a different analysis, the code worked (different tickers) now I get an error every time I try to run it.

My questions:

  • which command will solve my problem? --> Converting ^AEX into AEX so Excel eats it :)
Phil
  • 7,287
  • 3
  • 36
  • 66
Hendrik
  • 11
  • 1
  • On my end Ticker is of class character, so this is a simple character replacement. Does `Aggregate <- stringr::str_remove(Aggregate, "\\^")` work? – dcsuka Jul 31 '22 at 04:12

0 Answers0