Hi mighty R-gurus and other enthusiastics, I just encountered this: library(its) x <- its(sort(rnorm(10)), as.POSIXct(Sys.time() + 1:10)) plot(x, type = "p", pch = c(rep("A", 5), rep("B", 5))) Am I missing something if I expect that all the points labeled as 'A' should be below all those labeled as 'B'? Thanks, Jussi M?kinen 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
M?kinen Jussi <Jussi.Makinen <at> valtiokonttori.fi> writes: : : Hi mighty R-gurus and other enthusiastics, : : I just encountered this: : : library(its) : x <- its(sort(rnorm(10)), as.POSIXct(Sys.time() + 1:10)) : plot(x, type = "p", pch = c(rep("A", 5), rep("B", 5))) : : Am I missing something if I expect that all the points labeled as 'A' should be below all those labeled as 'B'? : Try this in place of your last line: plot(x, type = "p", pch = letters)>From that output it seems that it is erroneously plotting the firstpoint twice and the last point twice. This suggests the following workaround: plot(x, type = "p", pch = c(rep("A", 5+1), rep("B", 5+1))) Another possibility is to use the zoo package to plot it: library(zoo) plot(as.zoo(x), type = "p", pch = list(c(rep("A", 5), rep("B", 5))))
Seemingly Similar Threads
- A suggestion to improve ifelse behaviour with vector yes/no arguments
- A logit question?
- Add-on bug? Win fracdiff failed from http://www.stat.unipg.it/stat/statlib/R/CRAN/ (PR#2504)
- A suggestion to improve ifelse behaviour with vector yes/noarguments
- Add-on bug? Win fracdiff failed from http://www.stat.unipg.it/stat/statlib/R/CRAN/ (PR#2505)