[R] Change column of numbers in data frame to days

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Oct 23 17:17:48 CEST 2010



On 23.10.2010 17:08, will phillips wrote:
>
> Hello Dr. Pagel,
>
> Thank you very much for the input.  It is "almost" working.  It will
> indicate every day of the week except Sunday.  Any multiple of 7 is giving
> <NA>.
>
> I'll tinker with it a bit.  I really appreciate the direction you've
> provided.

foo <- factor((foo %% 7) + 1, levels = 1:7, labels=c('Sun', 'Mon', 
'Tue', 'Wed', 'Thu', 'Fri', 'Sat'))

will fix it.

Best,
Uwe Ligges


> Will
>
>
>
>



More information about the R-help mailing list