require(zoo) # Creating the csv file # filename <- "https://stooq.pl/q/d/l/?s=wig&i=d" # x <- read.csv(filename) # y <- x[,c(1,5)] # colnames(y) <- c("Daty","WIG") # write.csv(y,"GPW.csv", row.names = FALSE) filename <- "GPW.csv" dane <- read.csv2(file=filename, head=TRUE, sep=",", dec=".") WIG <- as.numeric(dane$WIG) daty <- as.Date(dane$Daty, format="%Y-%m-%d") P <- zoo(WIG, order.by = daty) r <- diff(log(P))