Re: [R] NA rows appeared in data.frame

2019-01-16 Thread peter dalgaard
There is some logic to getting something that you don't know what is when you don't know whether you want it or not. It is certainly more informative than not getting anything, just like if you indexed with FALSE. However, a more straightforward argument is that when you use integer indexing

Re: [R] NA rows appeared in data.frame

2019-01-16 Thread Ernest Han
> > Cheers > Petr > > > -Original Message- > > From: R-help On Behalf Of Rui Barradas > > Sent: Saturday, January 12, 2019 12:55 PM > > To: Ernest Han ; r-help@r-project.org > > Subject: Re: [R] NA rows appeared in data.frame > > &g

Re: [R] NA rows appeared in data.frame

2019-01-15 Thread PIKAL Petr
1$Petal.Width) [1] NA > mean(t1$Petal.Width, na.rm=T) [1] 1.147101 > Cheers Petr > -Original Message- > From: Ernest Han > Sent: Wednesday, January 16, 2019 3:27 AM > To: PIKAL Petr > Cc: r-help@r-project.org > Subject: Re: [R] NA rows appeared in data.frame >

Re: [R] NA rows appeared in data.frame

2019-01-14 Thread S Ellison
lto:r-help-boun...@r-project.org] On Behalf Of Ernest Han > Sent: 12 January 2019 08:23 > To: r-help@r-project.org > Subject: [R] NA rows appeared in data.frame > > Dear All, > > After replacing some values in a data.frame, NAs rows have appeared > and cannot be removed

Re: [R] NA rows appeared in data.frame

2019-01-14 Thread PIKAL Petr
Han ; r-help@r-project.org > Subject: Re: [R] NA rows appeared in data.frame > > Hello, > > You have to test for NA. Some (12) of the values of t1$Petal.Width are NA > therefore t1$Petal.Width == 2.0 alone returns 12 NA values. > > t1[t1$Petal.Width == 2.0 & !is.na(t1$Petal.Width

Re: [R] NA rows appeared in data.frame

2019-01-12 Thread Rui Barradas
Hello, You have to test for NA. Some (12) of the values of t1$Petal.Width are NA therefore t1$Petal.Width == 2.0 alone returns 12 NA values. t1[t1$Petal.Width == 2.0 & !is.na(t1$Petal.Width == 2.0), ] Or use which(t1$Petal.Width == 2.0). t1[which(t1$Petal.Width == 2.0), ] Hope this helps,

[R] NA rows appeared in data.frame

2019-01-12 Thread Ernest Han
Dear All, After replacing some values in a data.frame, NAs rows have appeared and cannot be removed. I have googled these issues and found that several people have encountered it. Solutions in stackoverflow seem to provide work-arounds but does not remove it from the data.frame. Therefore, I am