[Rd] question on latticeParseFormula (PR#2602)

Deepayan Sarkar deepayan@stat.wisc.edu
Tue Mar 4 02:54:03 2003


On Monday 03 March 2003 07:10 pm, rmh@surfer.sbm.temple.edu wrote:
> I didn't get a warning.  I got exactly what I sent.

That's odd. Because I get a warning on Linux, and on the outside chance that 
this might be a Windows issue, I just installed R 1.6.2 on Windows 2000 and 
got 

===========================================================
R : Copyright 2003, The R Development Core Team
Version 1.6.2  (2003-01-10)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.

> a = factor(1:4)
> b = factor(1:4)
> a + b
[1] NA NA NA NA
Warning message: 
"+" not meaningful for factors in: Ops.factor(a, b) 
>
============================================================


> The NA doesn't bother me since I am interested in parsing the expression,
> specifically to see what is to the left of the "~" and what is to the
> right of the "~".   I am interested in components left.name and right.name,
> .I am not interested in left and right.  My inference from your response
> is that I should work with the parse tree from
>   parse(text="y ~ a + b")
> rather than continue pushing latticeParseFormula.

Maybe you want something like

as.character(y ~ a + b)[-1]

Deepayan