Misundertanding of Levels

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Misundertanding of Levels

David Arnold
This post has NOT been accepted by the mailing list yet.
This post was updated on .
All,

Last night teaching class, I used the following data set.

http://lib.stat.cmu.edu/DASL/Datafiles/DraftLottery.html

I copied and saved the data in a file named lottery.dat. Then I wrote this code:

lottery=read.delim("lottery.dat")
boxplot(Draft_No.~Month,data=lottery)

The result was this image.

Draft Lottery I

I then tried to change the levels of the Month factor.

lottery=read.delim("lottery.dat")
levels(lottery$Month)=month.abb
boxplot(Draft_No.~Month,data=lottery)

The result was this image.

Draft Lottery I2

As you can see, this is incorrect. I then made a quick workarround with this code:

lottery=read.delim("lottery.dat")
boxplot(Draft_No.~Mo.Number,data=lottery,
        names=month.abb)

Which gives the correct image:

Draft Lottery 3

But my question lays with my misunderstanding of setting the levels of the Month factor. I thought that would work. I obviously need help understanding my mistake.

David
Reply | Threaded
Open this post in threaded view
|

Re: Misundertanding of Levels

David Arnold
I am replying so that this will be accepted by the list.

D.
Reply | Threaded
Open this post in threaded view
|

Re: Misundertanding of Levels

David Winsemius

On Feb 16, 2013, at 10:25 AM, David Arnold wrote:

> I am replying so that this will be accepted by the list.

I don't think you achieved your goal. Some posting from Nabble are never accepted. A couple of months ago the spam filters were tightened (in response to a robotic mediated mass forgery of Nabble postings) and Rhelp list members were notified that it might result in some Nabble postings being silently ignored. Your earlier posting is not in the moderation queue and I suspect it will never show up.

> --
> View this message in context: http://r.789695.n4.nabble.com/Misundertanding-of-Levels-tp4658320p4658781.html
>
--

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] 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.