I want to sort month names. When I use the strptime
function it returns an error as the attribute values only contains month names. When I use the sort
You could always convert your data to a factor. For example, suppose we have
x = c("January", "February", "March", "January")
then to convert to a factor, we have:
x_fac = factor(x, levels = month.name)
which on sorting gives:
R> sort(x_fac)
[1] January January February March
12 Levels: January February March April May June July August ... December