From pinard at iro.umontreal.ca  Tue Jul  3 04:18:06 2007
From: pinard at iro.umontreal.ca (=?iso-8859-1?Q?Fran=E7ois?= Pinard)
Date: Mon, 2 Jul 2007 22:18:06 -0400
Subject: [Rd] R 2.5.1 - ?factor examples, details
Message-ID: <20070703021806.GA28951@alcyon.progiciels-bpi.ca>

Hi, R people.

In ?factor, in the "Examples:" section, we see:

  ## suppose you want "NA" as a level, and to allowing missing values.
  (x <- factor(c(1, 2, "NA"), exclude = ""))
  is.na(x)[2] <- TRUE
  x  # [1] 1    <NA> NA, <NA> used because NA is a level.
  is.na(x)
  # [1] FALSE  TRUE FALSE

I'm a bit confused by this example, as I do not understand the point 
being made.  Using 'exclude = ""' or not does not change the outcome.
What is being demonstrated by this clause, here?  Isn't "NA" a mere 
string, not really related to a missing value?

It might also be some kind of linguistic problem, and I'm not a native 
English speaker.  The "and to allowing" construct sounds strange to me.  
I would expect either "and to allow" or "and allowing", but maybe I'm 
plainly missing the meaning of the statement.

Could this be clarified somehow?

-- 
Fran?ois Pinard   http://pinard.progiciels-bpi.ca



[Rd] R 2.5.1 - ?factor examples, details
=?iso-8859-1?Q?Fran=E7ois?= Pinard