# marshall some search words into a macro
fSql <- function(s,query) {
x <-noquote(strsplit(s, " ")[[1]])
y <-noquote(strsplit(query, "%")[[1]])
result <- " ";
nprm <- 1;
nvar <- 1
repeat {
if(nprm <= (length(y) )) {
result <- paste(result," ")
if(y[nprm] == "")
result <- paste(result,",")
else
result <-paste(result,y[nprm])
nprm <- nprm+1
if(nvar <= length(x)) {
result <- paste(result,x[nvar])
nvar <- nvar + 1
}
#print(nprm)
#print(nvar)
}
else break
}
result
}
That is my simple R code to fit an arbitrary set of words into a database query. I use this utility to make the text replacement under the simple variable rules in sql.
Later, when executed I generally get back a list of data series, each of which can be loaded, plotted, or described.
References:
R Project - Open system for statistical managment.
Thursday, May 6, 2010
R Fans
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment