So I have large list of xts objects which is OHLC data for 900 plus names. It orginally came in a dataframe coupled with other stuff I didn't need. I now want to use it in quantmod using getsymbols and load it into my environment however it is taking far too long. Anyone know a more efficient way of doing this or what I might be doing wrong? Can getSymbols handle a list of xts?
load(file = "biglistofdataframes.Rdata")
### Convert the list of dataframes to xts
list_of_xts <- lapply(listofdataframes,function(x) xts(x[,2:6],x$date))
####change column names to match quantmod
list_of_xts <- lapply(list_of_xts, setNames,nm = c("Open","High","Low","Close","Volume"))
####Save to Rdatafile
save(list_of_xts, file="1.RData")
#First I clear the environment then I load the data back into the environment
load("1.RData")
##
getSymbols("list_of_xts", src="RData", auto.assign=TRUE)#this craps out on me
The reason I am trying to get it into this format is so that I can replicate Ross Bennett's momentum code. See below
https://rbresearch.wordpress.com/2012/10/20/momentum-in-r-part-2/
I wouldn't expect this code to work:
getSymbols("list_of_xts", src = "RData", auto.assign = TRUE)
?getSymbols.RData says that Symbols (the first argument) should be "a character vector specifying the names of each symbol to be loaded". You don't have a symbol and file named "list_of_xts.RData".
Also, getSymbols.RData() expects each symbol to be in its own file, so you would have to write each xts object in your list to a separate file.
# Get some data
env_of_xts <- new.env()
getSymbols(symbols, env=env_of_xts)
# Write it to a temporary directory
tdir <- tempdir()
for (nm in names(env_of_xts)) {
save(list = nm, file = file.path(tdir, paste0(nm, ".RData")), envir = env_of_xts)
}
# Now you can use getSymbols() to load from file
getSymbols(symbols[1], src = "RData", dir = tdir, extension = "RData")
# [1] "AAPL"
head(AAPL)
# AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
# 2007-01-03 12.32714 12.36857 11.70000 11.97143 309579900 8.137179
# 2007-01-04 12.00714 12.27857 11.97429 12.23714 211815100 8.317789
# 2007-01-05 12.25286 12.31428 12.05714 12.15000 208685400 8.258555
# 2007-01-08 12.28000 12.36143 12.18286 12.21000 199276700 8.299341
# 2007-01-09 12.35000 13.28286 12.16429 13.22429 837324600 8.988768
# 2007-01-10 13.53571 13.97143 13.35000 13.85714 738220000 9.418928
i am unsure about what symbols RData contains, I do know however that you can generate a list of many xts with lapply and getsymbols. Here is my example using google for current stock data.
symbols<-c("AAPL", "AMZN","GOOGL", "F", "GM", "IBM", "ORCL")
List_of_xts<-lapply(symbols, function(sym){
List_of_Xts<-getSymbols(Symbols = sym, src = "google", auto.assign = FALSE)
})
str(List_of_xts)
resulting in:
> str(List_of_xts)
List of 7
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2794, 1:5] 12.3 12 12.2 12.3 12.3 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "AAPL.Open" "AAPL.High" "AAPL.Low" "AAPL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:05"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2794, 1:5] 38.7 38.6 38.7 38.2 37.6 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "AMZN.Open" "AMZN.High" "AMZN.Low" "AMZN.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:06"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2794, 1:5] 233 235 241 244 243 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "GOOGL.Open" "GOOGL.High" "GOOGL.Low" "GOOGL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:07"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2795, 1:5] 7.56 7.56 7.72 7.63 7.75 7.79 7.73 7.77 7.89 7.97 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "F.Open" "F.High" "F.Low" "F.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:08"
$ :An ‘xts’ object on 2010-11-18/2018-02-07 containing:
Data: num [1:1817, 1:5] 35 34.1 34.2 34 33.7 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "GM.Open" "GM.High" "GM.Low" "GM.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:08"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2795, 1:5] 97.2 97.2 97.6 98.5 99.1 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "IBM.Open" "IBM.High" "IBM.Low" "IBM.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:09"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2795, 1:5] 17.2 17.6 17.6 17.6 17.9 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "ORCL.Open" "ORCL.High" "ORCL.Low" "ORCL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:10"> str(List_of_xts)
List of 7
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2794, 1:5] 12.3 12 12.2 12.3 12.3 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "AAPL.Open" "AAPL.High" "AAPL.Low" "AAPL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:05"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2794, 1:5] 38.7 38.6 38.7 38.2 37.6 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "AMZN.Open" "AMZN.High" "AMZN.Low" "AMZN.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:06"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2794, 1:5] 233 235 241 244 243 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "GOOGL.Open" "GOOGL.High" "GOOGL.Low" "GOOGL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:07"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2795, 1:5] 7.56 7.56 7.72 7.63 7.75 7.79 7.73 7.77 7.89 7.97 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "F.Open" "F.High" "F.Low" "F.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:08"
$ :An ‘xts’ object on 2010-11-18/2018-02-07 containing:
Data: num [1:1817, 1:5] 35 34.1 34.2 34 33.7 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "GM.Open" "GM.High" "GM.Low" "GM.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:08"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2795, 1:5] 97.2 97.2 97.6 98.5 99.1 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "IBM.Open" "IBM.High" "IBM.Low" "IBM.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:09"
$ :An ‘xts’ object on 2007-01-03/2018-02-07 containing:
Data: num [1:2795, 1:5] 17.2 17.6 17.6 17.6 17.9 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "ORCL.Open" "ORCL.High" "ORCL.Low" "ORCL.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 2
..$ src : chr "google"
..$ updated: POSIXct[1:1], format: "2018-02-07 21:48:10"
Related
I have two data frames and I need to put the line of my second data frame as the last line of my first data frame:
The first data frame is PETR3.SA:
tail(PETR3.SA)
PETR3.SA.Open PETR3.SA.High PETR3.SA.Low PETR3.SA.Close
2020-04-23 17.35522 17.63133 16.85232 17.09884
2020-04-24 16.86218 17.01009 15.30415 15.84650
2020-04-27 16.14233 16.68468 15.74789 16.56635
2020-04-28 17.49000 18.02000 17.11000 18.02000
2020-04-29 18.51000 19.30000 18.35000 19.00000
2020-04-30 18.73000 19.18000 18.43000 18.65000
PETR3.SA.Volume PETR3.SA.Adjusted
2020-04-23 19498900 17.09884
2020-04-24 39716700 15.84650
2020-04-27 25446600 16.56635
2020-04-28 24004700 18.02000
2020-04-29 26938000 19.00000
2020-04-30 23209200 18.65000
str(PETR3.SA)
An ‘xts’ object on 2015-01-02/2020-04-30 containing:
Data: num [1:1322, 1:6] 9.07 8.18 7.84 7.86 8.15 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:6] "PETR3.SA.Open" "PETR3.SA.High" "PETR3.SA.Low" "PETR3.SA.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
List of 3
$ src : chr "yahoo"
$ updated : POSIXct[1:1], format: "2020-05-04 17:14:02"
$ na.action: 'omit' int [1:3] 779 1038 1281
..- attr(*, "index")= num [1:3] 1.52e+09 1.55e+09 1.58e+09
My second df:
cotacao_xts
PETR3.SA.Open PETR3.SA.High PETR3.SA.Low PETR3.SA.Close
2020-05-04 19.02 19.02 19.02 19.02
PETR3.SA.Volume PETR3.SA.Adjusted
2020-05-04 0 19.02
> str(cotacao_xts)
An ‘xts’ object on 2020-05-04/2020-05-04 containing:
Data: num [1, 1:6] 19 19 19 19 0 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:6] "PETR3.SA.Open" "PETR3.SA.High" "PETR3.SA.Low" "PETR3.SA.Close" ...
Indexed by objects of class: [Date] TZ: UTC
xts Attributes:
NULL
I need to put my second df (cotacao_xts) as the last line of my first df.
I tried bind_rows, but this is what I got:
> new_df <- PETR3.SA %>%
+ bind_rows(cotacao_xts)
Error: Argument 1 must have names
As these are xts objects, we can use rbind assuming the index are unique
library(xts)
rbind(PETR3.SA, cotacao_xts)
methods(class = 'xts')[50]
#[1] "rbind.xts"
According to ?bind_rows
... - Data frames to combine
It can be data.table, data.frame or tbl_df. The xts object is neither one of those. It is a matrix with xts attribute. If we need to use bind_rows, then the objects needs to be converted to data.frame
I'm a bit stuck at the moment, i have been able to create a spatial points data frame and out of this i made an object of the class Ltraj. This i will need to do further analysis. But my x and y coordinates aren't in UTM which might give problems if i do further analysis down the line.
Format:
x y date dx dy dist dt
1 -32.09245 116.0426 2015-08-07 00:22:00 -2.19e-05 0.0000194 2.925696e-05 1800 ...
Structure:
List of 1
$ :'data.frame': 109 obs. of 10 variables:
..$ x : num [1:109] -32.1 -32.1 -32.1 -32.1 -32.1 ...
..$ y : num [1:109] 116 116 116 116 116 ...
..$ date : POSIXct[1:109], format: "2015-08-07 00:22:00" "2015-08-07 00:52:00" "2015-08-07 01:22:00" "2015-08-07 01:52:00" ...
..$ dx : num [1:109] -2.19e-05 -5.73e-05 -5.15e-05 4.52e-05 -4.96e- 05 ...
..$ dy : num [1:109] 1.94e-05 -3.21e-04 -2.61e-05 2.75e-04 -1.06e-04 ...
..$ dist : num [1:109] 2.93e-05 3.26e-04 5.77e-05 2.79e-04 1.17e-04 ...
..$ dt : num [1:109] 1800 1800 1800 3840 1800 3600 1740 1920 4680 900 ...
..$ R2n : num [1:109] 0.00 8.56e-10 9.71e-08 1.24e-07 1.00e-08 ...
..$ abs.angle: num [1:109] 2.42 -1.75 -2.67 1.41 -2.01 ...
..$ rel.angle: num [1:109] NA 2.119 -0.925 -2.203 2.865 ...
..- attr(*, "id")= chr "2172"
..- attr(*, "burst")= chr "2172"
..- attr(*, "infolocs")='data.frame': 109 obs. of 1 variable:
.. ..$ pkey: Factor w/ 109 levels "2172.2015-08-07 00:22:00",..: 1 2 3 4 5 6 7 8 9 10 ...
- attr(*, "class")= chr [1:2] "ltraj" "list"
- attr(*, "typeII")= logi TRUE
- attr(*, "regular")= logi FALSE
- attr(*, "proj4string")=Formal class 'CRS' [package "sp"] with 1 slot
.. ..# projargs: chr NA
-->I was able to create a formal class Spatial points set from my lats and longs in the UTM format but that is a seperate object now:
Structure:
Formal class 'SpatialPoints' [package "sp"] with 3 slots
..# coords : num [1:109, 1:2] 409662 409664 409634 409631 409657 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
..# bbox : num [1:2, 1:2] 406647 13536726 415659 13551107
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "coords.x1" "coords.x2"
.. .. ..$ : chr [1:2] "min" "max"
..# proj4string:Formal class 'CRS' [package "sp"] with 1 slot
.. .. ..# projargs: chr "+init=epsg:32750 +proj=utm +zone=50 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
I basically want my values for x and y in the ltraj to be in UTM,
I guess i will probably have to do this before i create the object ltraj or even the spatial points dataframe.
I was wondering if anybody has any advice as to change my lats and longs to UTM within the original dataframe; or to make it into a spatial dataframe and then bind them again with the dataframe that contains "subject" and "date"?
Kind regards,
Sam Rycken
In mice package for extract complete dataset you can use complete() command as follow :
install.packages("mice")
library ("mice")
imp1=mice(nhanes,10)
fill1=complete(imp,1)
fill2=complete(imp,2)
fillall=complete(imp,"long")
But can some one tell me how to extract complete dataset in Amelia package??
install.packages("Amelia")
library ("Amelia")
imp2= amelia(freetrade, m = 5, ts = "year", cs = "country")
The str() function is always helpful here. You'll see that the complete datasets are stored in the imputations element of the object returned by amelia():
> str(imp2, 1)
List of 12
$ imputations:List of 5
..- attr(*, "class")= chr [1:2] "mi" "list"
$ m : num 5
$ missMatrix : logi [1:171, 1:10] FALSE FALSE FALSE FALSE FALSE FALSE ...
..- attr(*, "dimnames")=List of 2
$ overvalues : NULL
$ theta : num [1:9, 1:9, 1:5] -1 -0.0161 0.199 -0.0368 -0.0868 ...
$ mu : num [1:8, 1:5] -0.0161 0.199 -0.0368 -0.0868 -0.0658 ...
$ covMatrices: num [1:8, 1:8, 1:5] 0.8997 -0.3077 0.0926 0.2206 -0.1115 ...
$ code : num 1
$ message : chr "Normal EM convergence."
$ iterHist :List of 5
$ arguments :List of 23
..- attr(*, "class")= chr [1:2] "ameliaArgs" "list"
$ orig.vars : chr [1:10] "year" "country" "tariff" "polity" ...
- attr(*, "class")= chr "amelia"
To get each imputation alone, just do imp2$imputations[[1]], etc. up through all imputations that you requested. In your example, there are five:
> str(imp2$imputations, 1)
List of 5
$ imp1:'data.frame': 171 obs. of 10 variables:
$ imp2:'data.frame': 171 obs. of 10 variables:
$ imp3:'data.frame': 171 obs. of 10 variables:
$ imp4:'data.frame': 171 obs. of 10 variables:
$ imp5:'data.frame': 171 obs. of 10 variables:
- attr(*, "class")= chr [1:2] "mi" "list"
m trying to use this code in R, with package RgoogleMaps
R Version: 2.14.2
RgoogleMaps version: 1.1.9.15
I need to use these old versions, here's the code (works with newest versions)
PlotOnStaticMap(Map,lon=x,lat=y, FUN = points, pch=16, col=Colors)
but with these old versions, I find these error message:
List of 8
$ lat.center: num 45.6
$ lon.center: num 12.4
$ zoom : num 9
$ myTile : 'nativeRaster' int [1:640, 1:640] -1906967 -1906967 -1906967 -1446673 -1183245 -1183245 -1183245 -1183245 -1445905 -2235674 ...
..- attr(*, "channels")= int 4
$ BBOX :List of 2
..$ ll: num [1, 1:2] 45 11.5
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr "Y"
.. .. ..$ : chr [1:2] "lat" "lon"
..$ ur: num [1, 1:2] 46.2 13.3
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr "Y"
.. .. ..$ : chr [1:2] "lat" "lon"
$ url : chr "google"
$ size : int [1:2] 640 640
$ SCALE : num 1
NULL
[1] -148.7783 210.1525
[1] -131.7210 127.5206
Errore in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new hasn't been called yet
What's the problem?
Error was in Map. It was downloaded with newest version of the package, and oldest version didn't recognized it
When I use the list function:
el_nino_1974_2000_all <- list()
for (k in seq_along(el_nino_start_month)){
el_nino_1974_2000_all[[k]] = window(Nino3.4_Flow_1974_2000_zoo,
start = (as.Date(el_nino_1974_2000[k,]$el_nino_start_mont)),
end = (as.Date(el_nino_1974_2000[k,]$el_nino_finish_month)))
}
A gives a series of separate data subsets staring from i = 1. However, I want to merge all subsets into one frame of data either in zoo format or data frame format.
This is the structure of el_nino_1974_2000_all.
> str(el_nino_1974_2000_all)
List of 7
$ :‘zoo’ series from 1976-08-15 to 1977-01-15
Data: num [1:6, 1:2] 0.519 0.874 0.886 0.823 0.734 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:6], format: "1976-08-15" "1976-09-15" ...
$ :‘zoo’ series from 1982-05-15 to 1983-06-15
Data: num [1:14, 1:2] 0.961 1.388 0.959 1.171 1.564 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:14], format: "1982-05-15" "1982-06-15" ...
$ :‘zoo’ series from 1986-09-15 to 1988-01-15
Data: num [1:17, 1:2] 0.974 1.089 1.322 1.273 1.313 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:17], format: "1986-09-15" "1986-10-15" ...
$ :‘zoo’ series from 1991-05-15 to 1992-07-15
Data: num [1:15, 1:2] 0.68 1 0.923 0.773 0.68 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:15], format: "1991-05-15" "1991-06-15" ...
$ :‘zoo’ series from 1993-02-15 to 1993-07-15
Data: num [1:6, 1:2] 0.54 0.641 1.01 1.144 0.917 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:6], format: "1993-02-15" "1993-03-15" ...
$ :‘zoo’ series from 1994-08-15 to 1995-02-15
Data: num [1:7, 1:2] 0.662 0.746 1.039 1.329 1.301 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:7], format: "1994-08-15" "1994-09-15" ...
$ :‘zoo’ series from 1997-04-15 to 1998-05-15
Data: num [1:14, 1:2] 0.601 1.136 1.461 1.668 2.079 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:2] "Nino3.4_degree_1974_2000" "Houlgrave_flow_1974_2000"
Index: Date[1:14], format: "1997-04-15" "1997-05-15" ...
>
Sorry, I don't know how to do the formatting.
If the dates don't overlap, you can stick these together using rbind (since the number of columns is the same for each component). Try:
el_nino_1974_2000_all <- c()
for (k in seq_along(el_nino_start_month)){
el_nino_1974_2000_all <- rbind(el_nino_1974_2000_all,window(...))
}
Instead of the list construction you originally had.
This will return a zoo object.
If you want to return a data.frame, try using rbind, but with data.frame to convert your objects (this will work even if date indices overlap between each of your datasets):
el_nino_1974_2000_all <- data.frame()
for (k in seq_along(el_nino_start_month)){
el_nino_1974_2000_all <- rbind(el_nino_1974_2000_all,data.frame(window(...)))
}
Have you tried this function :
http://rss.acs.unt.edu/Rdoc/library/gtools/html/smartbind.html
out <- smartbind(list_of_dataframes)
Note : list_of_dataframes should contain data.frames but you can just transform you're data to dframes on the fly and then use this function.