[Rd] Is this a bug in the parser? (PR#7395)

rmh at temple.edu rmh at temple.edu
Sun Nov 28 05:36:08 CET 2004


# Your mailer is set to "none" (default on Windows),
# hence we cannot send the bug report directly from R.
# Please copy the bug report (after finishing it) to
# your favorite email program and send it to
#
#       r-bugs at r-project.org
#
######################################################



<<insert bug report here>>
Is this a bug in the parser?
Specifically, the trace lines

Browse[1]> x
[[1]]
[1] "factor(-(rowpos <= 2) + (rowpos >= 6), labels = c(\"1:2\", \"3:5\", "
[2] "    ~\"6:8\"))"                                                      

suggest that a single statement was arbitrarily cut into two pieces, neither
of which makes syntactic sense, when the string was too long.

The comparable line with shorter variable names is

Browse[1]> x
[[1]]
[1] "factor(-(r <= 2) + (r >= 6), labels = c(\"1:2\", \"3:5\", \"6:8\"))"


I am using rw2001
## Code to duplicate the problem:


options()$width
library(lattice) 
data(OrchardSprays) 
OrchardSprays$r <- OrchardSprays$rowpos

xyplot(decrease ~ treatment |
       factor(-(rowpos<=2)+(rowpos>=6), labels=c("1:2","3:5","6:8")),
       data=OrchardSprays)

xyplot(decrease ~ treatment |
       factor(-(r<=2)+(r>=6), labels=c("1:2","3:5","6:8")),
       data=OrchardSprays)

trace("names<-.default", exit=browser)

xyplot(decrease ~ treatment |
       factor(-(rowpos<=2)+(rowpos>=6), labels=c("1:2","3:5","6:8")),
       data=OrchardSprays)

xyplot(decrease ~ treatment |
       factor(-(r<=2)+(r>=6), labels=c("1:2","3:5","6:8")),
       data=OrchardSprays)



## transcript that shows the problem
##
## My mailer folds lines at 100 characters, I have several "Error",
## "Tracing", and "Called" lines that run out to 142.

> options()$width
[1] 80
> library(lattice) 
> data(OrchardSprays) 
> OrchardSprays$r <- OrchardSprays$rowpos
> xyplot(decrease ~ treatment |
+        factor(-(rowpos<=2)+(rowpos>=6), labels=c("1:2","3:5","6:8")),
+        data=OrchardSprays)
Error in "names<-.default"(`*tmp*`, value = c("factor(-(rowpos <= 2) + (rowpos >= 6), labels = c
(\"1:2\", \"3:5\", ",  : 
	names attribute [2] must be the same length as the vector [1]
> xyplot(decrease ~ treatment |
+        factor(-(r<=2)+(r>=6), labels=c("1:2","3:5","6:8")),
+        data=OrchardSprays)
> trace("names<-.default", exit=browser)
Tracing function "names<-.default" in package "base" 
[1] "names<-.default"
> xyplot(decrease ~ treatment |
+        factor(-(rowpos<=2)+(rowpos>=6), labels=c("1:2","3:5","6:8")),
+        data=OrchardSprays)
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> ls()
[1] "value" "x"    
Browse[1]> value
NULL
Browse[1]> x
[[1]]
[1] "factor(-(rowpos <= 2) + (rowpos >= 6), labels = c(\"1:2\", \"3:5\", "
[2] "    ~\"6:8\"))"                                                      

Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Error in "names<-.default"(`*tmp*`, value = c("factor(-(rowpos <= 2) + (rowpos >= 6), labels = c
(\"1:2\", \"3:5\", ",  : 
	names attribute [2] must be the same length as the vector [1]
Tracing "names<-.default"(`*tmp*`, value = structure(c("factor(-(rowpos <= 2) + (rowpos >= 6), 
labels = c(\"1:2\", \"3:5\", ",  .... on exit 
Called from: "names<-.default"(`*tmp*`, value = c("factor(-(rowpos <= 2) + (rowpos >= 6), labels = 
c(\"1:2\", \"3:5\", ", 
"    ~\"6:8\"))"))
Browse[1]> c
> xyplot(decrease ~ treatment |
+        factor(-(r<=2)+(r>=6), labels=c("1:2","3:5","6:8")),
+        data=OrchardSprays)
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> ls()
[1] "value" "x"    
Browse[1]> value
NULL
Browse[1]> x
[[1]]
[1] "factor(-(r <= 2) + (r >= 6), labels = c(\"1:2\", \"3:5\", \"6:8\"))"

Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = "factor(-(r <= 2) + (r >= 6), labels = c(\"1:2\", \"3:5
\", \"6:8\"))") on exit 
Called from: "names<-.default"(`*tmp*`, value = "factor(-(r <= 2) + (r >= 6), labels = c(\"1:2\", 
\"3:5\", \"6:8\"))")
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> c
Tracing "names<-.default"(`*tmp*`, value = NULL) on exit 
Called from: "names<-.default"(`*tmp*`, value = NULL)
Browse[1]> Q
> 



--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 2
 minor = 0.1
 year = 2004
 month = 11
 day = 15
 language = R

Windows XP Home Edition (build 2600) Service Pack 2.0

Search Path:
 .GlobalEnv, package:methods, package:stats, package:utils, package:datasets, 
file:c:/HOME/rmh/hh/splus.library/HH/.RData, package:multcomp, package:mvtnorm, package:abind, 
package:graphics, package:lattice, package:grid, package:grDevices, Autoloads, package:base



More information about the R-devel mailing list