Is it possible to rename factor's in a spineplot? The names of my factors are to long, so they overlap.
Thanks for your advices!
Is it possible to rename factor's in a spineplot? The names of my factors are to long, so they overlap.
Thanks for your advices!
 
    
     
    
    Reading the help for spineplot, it is clear that you can pass the parameters yaxlabels and xaxlabels to control the vectors for annotation of the axes.
One useful function is abbreviate which will shorten character strings.
Combining this information with the spineplot example gives:
treatment <- factor(rep(c(1, 2), c(43, 41)), levels = c(1, 2),
    labels = c("placebo", "treated"))
improved <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)),
    levels = c(1, 2, 3),
    labels = c("none", "some", "marked"))
spineplot(improved ~ treatment, yaxlabels=abbreviate(levels(improved), 2))

Not all of the plot functions in R have this type of parameter.  For a more general solution, it might be necessary to rename the factors before passing to a plot function.  You can access and modify factor names using the levels function:
levels(treatment) <- abbreviate(levels(treatment), 5)
plot(improved ~ treatment)

