[R] value.labels

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Aug 11 17:42:54 CEST 2011



On 11.08.2011 16:10, zcatav wrote:
> Hello R people,
>
> I have a "data.frame". Status variable has 3 values. 0->alive, 1->dead and
> 2->missed
> Status as a factor have correct levels. Levels and labels output as follows;
>
> levels(Adbf$status); labels(Adbf$status)
> [1] "0" "1" "2"
>    [1] "1"   "2"   "3"   "4"   "5"   "6"   "7"   "8"   "9"   "10"
>   [11] "11"  "12"  "13"  "14"  "15"  "16"  "17"  "18"  "19"  "20"
>   [21] "21"  "22"  "23"  "24"  "25"  "26"  "27"  "28"  "29"  "30"
>   [31] "31"  "32"  "33"  "34"  "35"  "36"  "37"  "38"  "39"  "40"
>   [41] "41"  "42"  "43"  "44"  "45"  "46"  "47"  "48"  "49"  "50"
>
> ........................................................................"644"
>
> Can i add value.labels to status variable? If yes how? Can i see these
> value.labels on results or graphics?


levels(Adbf$status) <- c("alive", "dead", "missed")

Uwe Ligges


> Thanks.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/value-labels-tp3735947p3735947.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list