0
$\begingroup$

enter image description here

I want to change the x axis column names to 1 to "Bad", 2 to "Neutral" and 3 to "Good".because histogram gives columns according to alpherbet.

my r codes are,

histogram(~ as.factor(AT_L) | Correct.Identification.of.Lion,
+           data=Lion,
+           layout=c(1,2),
+           col=c("navy blue","Red","green"))
$\endgroup$
4
  • 1
    $\begingroup$ This is off topic, as it is about programming and not statistics. $\endgroup$ Commented Sep 7, 2017 at 14:39
  • 1
    $\begingroup$ See the help center in relation to programming $\endgroup$
    – Glen_b
    Commented Sep 7, 2017 at 15:03
  • $\begingroup$ I want to know how to visualize my histogram result in an ordered way such as Bad, Neutral and Good. Normally histogram gives Bad, Good and Neutral because it works according to the alphabet. $\endgroup$
    – Nimalka
    Commented Sep 7, 2017 at 20:50
  • $\begingroup$ With a bit of work this question might be suitable for migration to Stack Overflow, but if you want to ask about programming (either there, or, if a statistical issue is relevant, here) please add a minimal reproducible example for people to work with. The problem with your code is that it is not a self-contained example - we do not have your data! And even if you did post your data here, it would be better to make the simplest possible example that reproduces your problem, rather than your full data set. $\endgroup$
    – Silverfish
    Commented Sep 7, 2017 at 21:33

1 Answer 1

1
$\begingroup$

Assuming that the factor groups are currently names "1", "2", and "3", you could try renaming the levels of the factor. A reproducible quick example of this would be:

Variable<-seq(1,3,1) Variable<-as.factor(Variable) levels(Variable) <- c("Bad","Neutral","Good") Variable

In your case perhaps you could try:

levels(AT_L) <- c("Bad","Neutral","Good")

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.