[R] separate elements of a character vector

Simon Kiss sjkiss at gmail.com
Tue Oct 19 18:55:51 CEST 2010


Dear colleagues, this seems like an easy problem, and I found some suggestions which I've incorporated in the help list, but I can't quite get it right.  
I want to add a series of years to a second x-axis category label. I generate them with test and test_2 below, format them with some spacing (which is the suggestion I took from the R-list) and concatenate them and then write them with mtext.  At the end, the labels in test are bunched up together in the center of the plot window.  Can anyone suggest a way to space out the elements of "test" to look like evenly-spaced x-labels?
Yours, 
Simon Kiss

x1<-rnorm(500)
plot(x1)

test<-seq(1987, 2002, by=1)

test_2<-seq(2003, 2006, by=1)

test<-format(c(test, test_2), width=5)

mtext(test, side=1, line=2)
*********************************
Simon J. Kiss, PhD
Assistant Professor, Wilfrid Laurier University
73 George Street
Brantford, Ontario, Canada
N3T 2C9
Cell: +1 519 761 7606



More information about the R-help mailing list