search for: dateloop

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

2007 Dec 06
3
using "eval(parse(text)) " , gsub(pattern, replacement, x) , to process "code" within a loop/custom function
...x,pat.i,rep.i) x #f <- function(x) if (mode(x) == "character") gsub("a", "green", x) else x }# end recurse end ####################### ####################### #function that processes code submitted as "text.i" for each date in "dates.i" fn.dateloop <- function(text.i, dates.i ) { for(d in 1: length(dates.i) ) { tempdate <- dates.i[d] text.i2 <- recurse(text.i, pat.i='#', rep.i=tempdate) temp0=eval(parse(t=text.i2)) tempname <- paste(names(temp0)[1], tempdate, sep='.') save(list='temp0', file = tempname) }...