Did you try what I suggested, which was to check your factor levels with str()?
And no, pasting your data into an email is not helpful, because it does not tell me how R sees it. Using str() to provide that information, or dput() to provide the data itself, is necessary. Sarah On Wed, Dec 11, 2013 at 5:40 PM, Yuanzhi Li <yuanzhi...@usherbrooke.ca> wrote: > Hello, The function bargraph.CI() is from the package "sciplot". with this > function. I have a data like this: > > level richness > CK 34 > ... ... > N5 25 > ... ... > N10 20 > ... ... > N15 27 > ... ... > > When I draw bargraph with this function, the bar sequence is > "CK","N10","N15","N5" but not "CK", "N5", "N10", "N15". > Do you know how to deal with it now? > > > Sarah Goslee <sarah.gos...@gmail.com> a écrit : > >> Without knowing where you got bargraph.CI() I can't answer that part, >> since it isn't part of base R, but the most likely cause is that you >> did not specify the desired levels of your factor. >> You can check with str(). >> >> Compare: >> >>> testdata <- factor(c("a", "b", "a", "c", "b")) >>> str(testdata) >> >> Factor w/ 3 levels "a","b","c": 1 2 1 3 2 >>> >>> >>> testdata <- factor(c("a", "b", "a", "c", "b"), levels=c("c", "b", "a")) >>> str(testdata) >> >> Factor w/ 3 levels "c","b","a": 3 2 3 1 2 >> >> Sarah >> >> On Wed, Dec 11, 2013 at 5:06 PM, Yuanzhi Li <yuanzhi...@usherbrooke.ca> >> wrote: >>> >>> hello, >>> >>> I had a problem with the function "bargraph.CI". "bargraph.CI" draws a >>> figure according to the alphabet sequence of the factor used. For >>> example, I >>> have a factor with for levels "CK", "N5", "N10", "N15", but the bars >>> appear >>> in "CK","N10","N15","N5" order(alphabet sequence), but I want the bars to >>> appear "CK", "N5", "N10", "N15"(treat level sequence). Do you have any >>> ideas to realize the goal? >>> >>> Thank you! >>> >>> >>> Yuanzhi >>> >> -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.