Re: [R] as.character and a formula

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Wed 17 Aug 2005 - 04:22:08 EST

Gavin Simpson wrote:

> Dear list,
>
> given this formula:
>
>

>>fmla <- formula(y1 ~ spp1 + spp2 + spp3 + spp5)
>>fmla[[3]]

>
> spp1 + spp2 + spp3 + spp5
>
> is this the intended behaviour of as.character:
>
>
>>as.character(fmla[[3]])

>
> [1] "+" "spp1 + spp2 + spp3" "spp5"
>
> ? Where does the extra "+" come from?

Which *extra* "+"?

This expression is the same as

"+"(spp1 + spp2 + spp3, spp5)

hence "+" with arguments "spp1 + spp2 + spp3" and "spp5"

Same below.

Uwe Ligges

>

>>as.character(fmla)

>
> [1] "~" "y1"
> [3] "spp1 + spp2 + spp3 + spp5"
>
> Thanks in advance,
>
> Gav


R-help@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 Received on Wed Aug 17 04:28:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:50 EST