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

AbouEl-Makarim Aboueissa @bouelm@k@rim1962 @ending from gm@il@com
Thu Sep 20 19:14:41 CEST 2018


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]]



More information about the R-help mailing list