Dear list, A follow up on this thread - the solution I ended up with does indeed involve "parse()". However, it does the job, and it is more efficient than what I came up with in my other attempts.
suspicious.vowels <- function(data,factors,vowelcolumn,f1,f2) { for(currfac in c(factors,vowelcolumn,f1,f2)){ if(!currfac %in% names(data)){ stop("Factor '",currfac,"' does not exist in the data frame. Please provide only valid column names.") } } # The dirty hack! facs <- paste(factors,collapse=",") mycall <- paste("ddply(data,.(",facs,"),summarize,norms=vector.space(",f1,",",f2,")[[3]],angles=vector.space(",f2,",",f2,")[[4]])",sep="") nADatap <- parse(text=mycall) nAData <- eval(nADatap)) ..... } However, if anyone would like to weigh in with a more structured solution, I would very much appreciate the opportunity to learn how this _should_ really be done. /Fredrik On Mon, Mar 5, 2012 at 2:11 AM, David Winsemius <dwinsem...@comcast.net>wrote: > > On Mar 4, 2012, at 6:28 PM, Fredrik Karlsson wrote: > > Hi Joshua, >> >> Yes, sorry - I attached an .rda file - maybe it was squashed. >> > > The old version of the Posting Guide warned readers that only 'txt' files > and 'pdf's would be acceptable attachments. I think the new modified Guide > is less specific. You could ahve posted the output of dput on the object > and given it an extension of .txt so that your email client would have > labeled it properly at the right mime-type. > > -- > > David Winsemius, MD > West Hartford, CT > > -- "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it." [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.