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
as
a(t1$Petal.Width),]
>
> 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 dat
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
>
t, if you
haven't already.
S Ellison
> -Original Message-
> From: R-help [mailto: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,
>
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
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,
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 tu
7 matches
Mail list logo