Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.

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

Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.

AbouEl-Makarim Aboueissa-3
Dear All:

*Re:* How to make the Month variable be called “May”,“June”, "July",
"August", "September" instead of a numeric quantity (5,6,7,8,9)


In the airquality data set, please see the code below; How to make the
Month variable be called “May”,“June”, "July", "August", "September"
instead of a numeric quantity (5,6,7,8,9)



data(airquality)

head(airquality)


#### Making Day and Month categorical variables


airquality$Day <- factor(airquality$Day)

airquality$Month <- factor(airquality$Month)


head(airquality)


> head(airquality)
  Ozone Solar.R Wind Temp Month Day
1    41     190  7.4   67     5   1
2    36     118  8.0   72     5   2
3    12     149 12.6   74     5   3
4    18     313 11.5   62     5   4
5    NA      NA 14.3   56     5   5
6    28      NA 14.9   66     5   6
>



Thank you very much for your help in advance


with thanks
abou
______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor of Statistics*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.

Jeff Newmiller
airquality$Month <- factor(airquality$Month, levels=1:12, labels=month.name )

On September 20, 2018 10:14:41 AM PDT, AbouEl-Makarim Aboueissa <[hidden email]> wrote:

>Dear All:
>
>*Re:* How to make the Month variable be called “May”,“June”, "July",
>"August", "September" instead of a numeric quantity (5,6,7,8,9)
>
>
>In the airquality data set, please see the code below; How to make the
>Month variable be called “May”,“June”, "July", "August", "September"
>instead of a numeric quantity (5,6,7,8,9)
>
>
>
>data(airquality)
>
>head(airquality)
>
>
>#### Making Day and Month categorical variables
>
>
>airquality$Day <- factor(airquality$Day)
>
>airquality$Month <- factor(airquality$Month)
>
>
>head(airquality)
>
>
>> head(airquality)
>  Ozone Solar.R Wind Temp Month Day
>1    41     190  7.4   67     5   1
>2    36     118  8.0   72     5   2
>3    12     149 12.6   74     5   3
>4    18     313 11.5   62     5   4
>5    NA      NA 14.3   56     5   5
>6    28      NA 14.9   66     5   6
>>
>
>
>
>Thank you very much for your help in advance
>
>
>with thanks
>abou
>______________________
>
>
>*AbouEl-Makarim Aboueissa, PhD*
>
>*Professor of Statistics*
>*Graduate Coordinator*
>
>*Department of Mathematics and Statistics*
>*University of Southern Maine*
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>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.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.

AbouEl-Makarim Aboueissa-3
Dear Jeff:

thank you very much

abou

______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor of Statistics*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*



On Thu, Sep 20, 2018 at 1:37 PM Jeff Newmiller <[hidden email]>
wrote:

> airquality$Month <- factor(airquality$Month, levels=1:12, labels=
> month.name )
>
> On September 20, 2018 10:14:41 AM PDT, AbouEl-Makarim Aboueissa <
> [hidden email]> wrote:
> >Dear All:
> >
> >*Re:* How to make the Month variable be called “May”,“June”, "July",
> >"August", "September" instead of a numeric quantity (5,6,7,8,9)
> >
> >
> >In the airquality data set, please see the code below; How to make the
> >Month variable be called “May”,“June”, "July", "August", "September"
> >instead of a numeric quantity (5,6,7,8,9)
> >
> >
> >
> >data(airquality)
> >
> >head(airquality)
> >
> >
> >#### Making Day and Month categorical variables
> >
> >
> >airquality$Day <- factor(airquality$Day)
> >
> >airquality$Month <- factor(airquality$Month)
> >
> >
> >head(airquality)
> >
> >
> >> head(airquality)
> >  Ozone Solar.R Wind Temp Month Day
> >1    41     190  7.4   67     5   1
> >2    36     118  8.0   72     5   2
> >3    12     149 12.6   74     5   3
> >4    18     313 11.5   62     5   4
> >5    NA      NA 14.3   56     5   5
> >6    28      NA 14.9   66     5   6
> >>
> >
> >
> >
> >Thank you very much for your help in advance
> >
> >
> >with thanks
> >abou
> >______________________
> >
> >
> >*AbouEl-Makarim Aboueissa, PhD*
> >
> >*Professor of Statistics*
> >*Graduate Coordinator*
> >
> >*Department of Mathematics and Statistics*
> >*University of Southern Maine*
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >[hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >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.
>
> --
> Sent from my phone. Please excuse my brevity.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.