[R] Deleting a specific value in a column of a data frame

ruipbarradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sat Jun 23 19:11:58 CEST 2018


Hello,
Also possible is

is.na (B) <- B >= A

Hope this helps,
Rui Barradas 


Enviado a partir do meu smartphone Samsung Galaxy.-------- Mensagem original --------De: Bert Gunter <bgunter.4567 using gmail.com> Data: 23/06/2018  15:26  (GMT+00:00) Para: javad bayat <j.bayat194 using gmail.com> Cc: R-help <R-help using r-project.org> Assunto: Re: [R] Deleting a specific value in a column of a data frame 
You understand, of course, that all columns in a data frame must be of the
same length; and that "NA" is not the same as NA?

This is pretty basic stuff and suggests you need to spend some time with an
R tutorial or two.

In any case, a construct of the form:

B[B >= A] <- NA

should do.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sat, Jun 23, 2018 at 4:09 AM, javad bayat <j.bayat194 using gmail.com> wrote:

> Dear R users;
> I have two columns data frame (column names is A and B). I want to write a
> function in order to compare column of B with A and if the values of B are
> equal or greater than that of A, replace them with "NA" or delete them and
> if the values of B are less than values in A, do nothing.
>
> Sincerely.
>
> --
> Best Regards
> Javad Bayat
> M.Sc. Environment Engineering
> Alternative Mail: bayat194 using yahoo.com
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list