I have made an example dataframe with 3 columns: Colour, Value and Size. Rows are filled with numeric values, text and empty cells.
Colour Value Size
Red 1 Big
Red nd Small
Blue nd Big
Blue NA Big
Blue 1 Medium
Yellow 1 NA
Yellow 2 Big
Green NA NA
Green nd Medium
The colour column has duplicated colours which can have different values in the Value column.
If a numeric value is found in the Value column, then I want to select that row together with the rows that have non numeric values of the same colour. So the new dataframe would look like this:
Colour Value Size
Red 1 Big
Red nd Small
Blue nd Big
Blue NA Big
Blue 1 Medium
Yellow 1 NA
Yellow 2 Big
So for example, if 1 row has a numeric value for the colour red, then I want to select every row for the red colour, numeric and non numeric.
If a colour has no numeric values at all, then it will be completely discarded, such as green in my example.
Any ideas how to accomplish this?