[6547] in s-news-athena

home help back first fref pref prev next nref lref last post

replace -99 by NA

daemon@ATHENA.MIT.EDU (Chang Yu)
Wed Mar 1 20:36:11 1995

Date: Wed, 1 Mar 95 18:40:32 CST
From: "Chang Yu" <chang@muskie.biostat.umn.edu>
To: S-news@utstat.toronto.edu
Cc: chang@muskie.biostat.umn.edu

Hi, Dear all,

It is a simple question. I just could not get it.
Here is part of my data:

> dlsoa.data 
 pid weight cad no-social male age75-79 age80-84 age85+ low-income stroke 
1   1   2128   0         0    0        0        1      0          0      0
2   2   4396   1         0    1        0        0      0        -99      0
5   7   2128   0         0    0        0        1      0          0      0
6   8   2128   0         0    0        0        1      0          1      0
  cancer arthritis diabets control status dement3 
1      0         1       0       0      1       0
2      0         0       1       1      0       0
5      0         0       1     -99      1       0
6      0         0       0     -99      0       0

In the data file the missing data were coded as -99 and they were read into 
a data frame as -99 by function "read.table".

Now I want to replace -99 by NA so tree() function will know it, otherwise
it will work on it as if they are numerical values -99. I tried the argument
"na.strings="  -99"" without any luck. It is the wrong way to do it.

Could anyone give me a hint?

Thanks a lot!


Chang Yu

chang@muskie.biostat.umn.edu

home help back first fref pref prev next nref lref last post