AbouEl-Makarim Aboueissa
2018-Sep-20 17:14 UTC
[R] Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.
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]]
Jeff Newmiller
2018-Sep-20 17:36 UTC
[R] Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.
airquality$Month <- factor(airquality$Month, levels=1:12, labels=month.name ) On September 20, 2018 10:14:41 AM PDT, AbouEl-Makarim Aboueissa <abouelmakarim1962 at gmail.com> 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]] > >______________________________________________ >R-help at r-project.org 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.
AbouEl-Makarim Aboueissa
2018-Sep-20 20:37 UTC
[R] Make Month variable be called “May”,“June” etc., instead of a numeric quantity 5,6, etc.
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 <jdnewmil at dcn.davis.ca.us> wrote:> airquality$Month <- factor(airquality$Month, levels=1:12, labels> month.name ) > > On September 20, 2018 10:14:41 AM PDT, AbouEl-Makarim Aboueissa < > abouelmakarim1962 at gmail.com> 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]] > > > >______________________________________________ > >R-help at r-project.org 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]]