[R] Remove

Val v@|kremk @end|ng |rom gm@||@com
Sat Jan 29 03:20:42 CET 2022


Hi All,

I want  remove row(s) that contains a character string in an integer column
or  a digit in a character column

Sample data
dat1 <-read.table(text="Name, Age, Weight
 Alex,  20,  13X
 Bob,   25,  142
 Carol, 24,  120
 John,  3BC,  175
 Katy,  35,  160
 Jack3, 34,  140",sep=",",header=TRUE,stringsAsFactors=F)

If the Age/Weight column contains any character(s) then remove
if the Name  column contains any  digit then remove that row

Desired output

   Name   Age weight
1   Bob     25    142
2   Carol   24    120
3   Katy    35    160

Thank you,

	[[alternative HTML version deleted]]



More information about the R-help mailing list