hello R-users.I really need your help on these one.i have two vectors
x and y of equal length.y contains missing values,so i need to remove
them.i know how to do that for y but i also need the corresponding x
value to be removed too.i cannot find or at least think of a command
miss - is.na(y)
y.good - y[!miss]
x.good - x[!miss]
HTH,
Andy
From: klea lambrou
hello R-users.I really need your help on these one.i have
two vectors
x and y of equal length.y contains missing values,so i
need to remove
them.i know how to do that for y but i also need the
On Wed, 2004-03-17 at 11:42, klea lambrou wrote:
hello R-users.I really need your help on these one.i have two vectors
x and y of equal length.y contains missing values,so i need to remove
them.i know how to do that for y but i also need the corresponding x
value to be removed
not.ok - is.na(y)
y.new - y[! not.ok]
x.new - x[! not.ok]
should work.
jan
On Wed, 17 Mar 2004, klea lambrou wrote:
hello R-users.I really need your help on these one.i have two vectors
x and y of equal length.y contains missing values,so i need to remove
them.i know how to do
I think the easiest way is using na.omit function which omits pairs of data
Look at the following example:
x - c(0,1,2,3,4,5)
y - c(NA,2, 3, 5, NA, 6)
data.1 - data.frame(x,y)
data.1
x y
1 0 NA
2 1 2
3 2 3
4 3 5
5 4 NA
6 5 6
new.data - na.omit(data.1)
new.data
x y
2 1 2
3 2 3
4 3