R has missing elements in character vectors: S does not.
On Thu, 17 Feb 2005, array chip wrote:
how can I set some elements in a character matrix as
missing values (NAs)? for example:
x<-matrix(rep('q',30),nrow=5)
x[x=='q']<-NA
will give me a character matrix with all elements
being "NA", but not missing values NA. The above codes
work prefectly well in R, but do not give me the right
answerin S-Plus. However, the codes work well if the
input matrix x is a numeric matrix.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|