Aarti Dahiya
2006-Jun-26 22:17 UTC
[R] Passing arguments from a function within another function
Hi all, I have a function getSomeData() that is called from command line - getSomeData(id='1240'). The function getSomeData() calls another function getData that needs the exact same argument passed to getSomeData(). I am using the function call getData(paste(names(args[1]), "=", sQuote(args[[1]]))). The argument passed is- id='1240'. The problem is that in getData(), it treats the whole thing "id='1240'" as one arguments i.e. for getData args[[1]] is "id='1240'". Hence, I am unable to extract the name id and the value of id separately. Beacuse of this, I am not able to generate the SQL query select * from table where id = '1240'. Thank you. Aarti
Gabor Grothendieck
2006-Jun-27 02:01 UTC
[R] Passing arguments from a function within another function
See: http://tolstoy.newcastle.edu.au/R/help/06/06/29301.html On 6/26/06, Aarti Dahiya <aarti_dahiya at hotmail.com> wrote:> Hi all, > > I have a function getSomeData() that is called from command line - > getSomeData(id='1240'). The function getSomeData() calls another function > getData that needs the exact same argument passed to getSomeData(). I am > using the function call getData(paste(names(args[1]), "=", > sQuote(args[[1]]))). The argument passed is- id='1240'. > > The problem is that in getData(), it treats the whole thing "id='1240'" as > one arguments i.e. for getData args[[1]] is "id='1240'". Hence, I am unable > to extract the name id and the value of id separately. Beacuse of this, I > am not able to generate the SQL query select * from table where id = '1240'. > > Thank you. > > Aarti > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >