s-news
[Top] [All Lists]

Re: Simple NA problem

To: Jan Ivanouw <ivanouw@post8.tele.dk>
Subject: Re: Simple NA problem
From: Dimitris Rizopoulos <Dimitris.Rizopoulos@med.kuleuven.be>
Date: Mon, 31 Dec 2007 12:28:35 +0100
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <000c01c84b9e$b0bde4d0$6401a8c0@JansAthlon64>
References: <20071230052101.JLNK22041.fep22.mail.dk@smtp.biostat.wustl.edu> <000c01c84b9e$b0bde4d0$6401a8c0@JansAthlon64>
User-agent: Internet Messaging Program (IMP) H3 (4.1.2)
say 'data' is your data.frame, then try this:

data[!is.na(data$a), ]


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Jan Ivanouw <ivanouw@post8.tele.dk>:

I am sorry I can't find the solution to this simple problem. Can anyone help?

I have a (large) data frame with missing values, like this:

a       b     c
1       3     5
NA    9     2
3       5     2
NA    8     6
5       3     7

Based on non-missing values of variable a, I want it changed to

a     b     c
1     3     5
3     5     2
5     3     7


Thank you

Jan Ivanouw PhD
University of Copenhagen
Denmark




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


<Prev in Thread] Current Thread [Next in Thread>