Skip to content

Select dataframe row containing a digit

2 messages · Rolf Turner, Luigi Marongiu

#
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
#
Thank you, those are all viable solutions.
Regards
Luigi
On Wed, Nov 30, 2022 at 8:59 PM Rolf Turner <r.turner at auckland.ac.nz> wrote: