[Rd] question on latticeParseFormula (PR#2602)

rmh@surfer.sbm.temple.edu rmh@surfer.sbm.temple.edu
Tue Mar 4 01:04:03 2003


This feels like inconsistent behavior.  latticeParseFormula works the
way I anticipated for factor, but not for ordered.  I want the
behavior I see with tmp2, but not with tmp.  My next step is to use
the right.name to isolate the tmp2[,c("a","b")] columns.


tmp <- data.frame(y=(1:12)+.1,
                  a=factor(rep(1:3,4)),
                  b=ordered(rep(1:4, c(3,3,3,3))))
latticeParseFormula(as.formula(y ~ a + b), data=tmp)

tmp2 <- data.frame(y=(1:12)+.1,
                  a=factor(rep(1:3,4)),
                  b=factor(rep(1:4, c(3,3,3,3))))
latticeParseFormula(as.formula(y ~ a + b), data=tmp2)


> version
         _              
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    6.2            
year     2003           
month    01             
day      10             
language R              
> tmp <- data.frame(y=(1:12)+.1,
+                   a=factor(rep(1:3,4)),
+                   b=ordered(rep(1:4, c(3,3,3,3))))
> latticeParseFormula(as.formula(y ~ a + b), data=tmp)
Error in a + b : non-numeric argument to binary operator
> 
> tmp2 <- data.frame(y=(1:12)+.1,
+                   a=factor(rep(1:3,4)),
+                   b=factor(rep(1:4, c(3,3,3,3))))
> latticeParseFormula(as.formula(y ~ a + b), data=tmp2)
$left
 [1]  1.1  2.1  3.1  4.1  5.1  6.1  7.1  8.1  9.1 10.1 11.1 12.1

$right
 [1] NA NA NA NA NA NA NA NA NA NA NA NA

$condition
NULL

$left.name
[1] "y"

$right.name
[1] "a + b"

> 

Rich