\begin{Schunk}
\begin{Sinput}
  x <- c("Y","N","Y","Y","F","N")
  is.factor(x)
  is.character(x)
  xf1 <- factor(x)
  xf1
  levels(xf1)
  x[1] <- "P"
  xf1[1] <- "P"
  xf1[1] <- "F"
  xf1levs <- levels(xf1)
  xf1[1] <-  xf1levs[2]
  xf2 <- factor(x, levels = c("Y","N","anything"), labels  = c("HECK","YES","irrelevant"))
  table(x, xf2, exclude = NULL)
  xf2[1] <- "Y"
  levels(xf2)
  xf2[1] <- "HECK"
  xf2
\end{Sinput}
\end{Schunk}
