Hi All, I have a doubt. I used macros and i try to pass a value to a macro by concatenating a bunch of strings. But it does not seem to work. Please help. I have written down my code and the error message please tell me how to pass the value that a string points to. Thanks in advance
#macro defined machist_occ_kgfs<-defmacro(a,qnu_occ,b,qnl_occ,expr={with(subset(an_ind_data_fin,income_source==a & region_id==b & normalised_income>qnl_occ & normalised_income<qnu_occ),hist(normalised_income,main=paste(a,b,sep=" ")))}) #macro called machist_occ_kgfs(occ,paste("qnu",ri,occ,collapse="",sep=""),ri,paste("qnl",ri,occ,collapse="",sep="")) Error in hist.default(normalised_income, main = paste(occ, ri, sep = " "), : hist.default: pretty() error, breaks= In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf The thing is paste("qnu",ri,occ,collapse="",sep="") returns the value "qnu1Business__Others" but the variable - qnu1Business__Others contains an integer value which i need to be passed on to the macro. Hope i have made myself clear. Thanks in advance for your help -- View this message in context: http://r.789695.n4.nabble.com/Help-with-getting-values-from-string-tp4605632.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.