search for: tq_mutate_xy

Displaying 1 result from an estimated 1 matches for "tq_mutate_xy".

2017 Oct 18
1
Problem with tq_mutate_xy() from the tidyquant package
...#window = window size in days tbl <- timetk::tk_tbl( aXts[,c(col1,col2)], rename_index="date" ) colnames(tbl) <- c("date","x","y") naV <- sapply(1:nrow(tbl), function(i) any(is.na(tbl[i,])) ) tbl <- tbl[!naV,]# remove any rows with NAs tq_mutate_xy( data=tbl, x = x, y = y, mutate_fun=runCor, n = window, use="all.obs", # runCor args col_rename = "rolling_corr" ) # tq_mutate args } foo <- rolling_corrOnePair( aXts=smallXts, col1="foo", col2="bar", window=30 ) ## This...