[R] lattice tick marks
Deepayan Sarkar
deepayan.sarkar at gmail.com
Thu Mar 16 16:46:28 CET 2006
On 3/16/06, vincent david <vega42 at googlemail.com> wrote:
> Hi,
>
> why doesn't this work properly when 'positions' is a vector of strings? All
> the data sets get totally mixed...
>
> positions <- rep ( c("1","2","3","4","5","6","9","10","11","12","13","14",
> "error", "no trial"), 45 )
> compound <- matrix( c(loc2, loc1, error, no_trial), nrow=4, byrow=FALSE)
Which gives me
Error in as.vector(data) : object "loc2" not found
to say nothing of the fact that 45 * 14 = 630 is not a multiple of 4.
You are not really helping your chances of getting a useful answer by
making other people waste their time replicating your problems.
> barchart(compound ~ positions|gl (45,14, label=template ),
> col=c("deepskyblue1", "deepskyblue4", "tomato", "brown"),
> ...
Possibly relevant excerpts from ?barchart (the very first argument, in fact):
Arguments:
x: The object on which method dispatch is carried out.
[...]
The 'x' and 'y' variables should both be numeric in 'xyplot',
and an attempt is made to coerce them if not. However, if
either is a factor, the levels of that factor are used as
axis labels. In the other four functions documented here,
exactly one of 'x' and 'y' should be numeric, and the other a
factor or shingle. Which of these will happen is determined
by the 'horizontal' argument - if 'horizontal=TRUE', then 'y'
will be coerced to be a factor or shingle, otherwise 'x'. The
default value of 'horizontal' is 'FALSE' if 'x' is a factor
or shingle, 'TRUE' otherwise. (The functionality provided by
'horizontal=FALSE' is not S-compatible.)
Deepayan
More information about the R-help
mailing list