Hi,

try this(Not tested):

substitute(expression(1+2*pred+3*lat),list(pred=as.name(x1),lat=as.name(x2)))





On 05/10/2007, Ronaldo Reis Junior <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I try to use a substitute function to generalise a equation.
>
> I have this:
>
> expression(1+2*pred+3*lat)
>
> I need to define the equation in function of x1 and x2 variables. Also I
> try
> to define who is x1 and x2. I try this:
>
> X1 <- "pred"
> X2 <- "lat"
>
> Now I need substitute pred and lat in equation by x1 and x2 defined on X1
> and
> X2 above, I try this way:
>
> >
> substitute(expression(1+2*pred+3*lat),list(as.name(X1)=as.name(x1),as.name
> (X2)=as.name(x2))
> Error: unexpected '='
> in "substitute(expression(1+2*pred+3*lat),list(as.name(X1)="
>
> My expected result is:
>
> expression(1 + 2 * x1 + 3 * x2)
>
> Any help?
> Thanks
> Ronaldo
> --
> > Prof. Ronaldo Reis Júnior
> |  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional
> | : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
> | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
> |   `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] |
> [EMAIL PROTECTED]
> | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366
>
> ______________________________________________
> 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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[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.

Reply via email to