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

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sat Jun 23 16:26:44 CEST 2018

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.


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]]

More information about the R-help mailing list