Skip to content
Prev 393296 / 398500 Next

Select dataframe row containing a digit

On Wed, 30 Nov 2022 13:40:50 +0100
Luigi Marongiu <marongiu.luigi at gmail.com> wrote:

            
What I do in such circumstances:

suppressWarnings(X$val[!is.na(as.numeric(X$val))] <- "NUM")

The "suppressWarnings()" bit is just included due to my OCD.

This avoids fooling about with regular expressions, which always
requires a huge amount of trial and error, and a great diminishment of
the amount of hair on one's head (as a result of tearing out).

Note that I have changed the name of your data frame from "df" to "X",
since df() is a built-in R function (density of the F-distribution).

See fortunes::fortune("might clash").

cheers,

Rolf Turner