[R] How to coerce this?

Gang Chen gangchen at mail.nih.gov
Thu Oct 25 19:49:52 CEST 2007


This is the command I want to execute with function contrast in  
contrast package:

 > contrast(MyObject, list(Trust="T"), list(Trust="U"));

As the two arguments with 'list' are defined as a string of  
characters, contr:

 > str(contr)
  chr "list(Trust=\"T\"),list(Trust=\"U\")"

I would like to run something like

 >  contrast(MyObject, paste(contr))

However this doesn't work since I get an error message out of this:

Error in gendata.default(fit = list(modelStruct = list(reStruct = list 
( :
   not enough factors

I guess I'd have to coerce 'contr' somehow to let contrast know the  
two arguments instead of just one. How can I do that?

Thanks in advance,
Gang



More information about the R-help mailing list