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) barchart(compound ~ positions|gl (45,14, label=template ), col=c("deepskyblue1", "deepskyblue4", "tomato", "brown"), ... If I change the vector 'positions' to something like this: positions <- rep ( c(1,2,3,4,5,6,9,10,11,12,13,14,16,17), 45 ) it works just fine... I'm especially confused, since I remember using string vectors on a bwplot() earlier without any mixups. cheers Vincent [[alternative HTML version deleted]]
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) barchart(compound ~ positions|gl (45,14, label=template ), col=c("deepskyblue1", "deepskyblue4", "tomato", "brown"), ... If I change the vector 'positions' to something like this: positions <- rep ( c(1,2,3,4,5,6,9,10,11,12,13,14,16,17), 45 ) it works just fine... I'm especially confused, since I remember using string vectors on a bwplot() earlier without any mixups. cheers Vincent [[alternative HTML version deleted]]
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) barchart(compound ~ positions|gl (45,14, label=template ), col=c("deepskyblue1", "deepskyblue4", "tomato", "brown"), ... If I change the vector 'positions' to something like this: positions <- rep ( c(1,2,3,4,5,6,9,10,11,12,13,14,16,17), 45 ) it works just fine... I'm especially confused, since I remember using string vectors on a bwplot() earlier without any mixups. cheers Vincent [[alternative HTML version deleted]]
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