[R] ls() pattern question

Kai Yang y@ngk@|9999 @end|ng |rom y@hoo@com
Thu Jul 15 01:40:57 CEST 2021

Hello List,
I have many data frames in environment.  I need to keep 3 data frames only, con DB2 and ora. 
I write the script to do this. 
rm(ls(pattern != c("(con|DB2|ora)")))

but it give me an error message:

Error in rm(ls(pattern != c("(con|DB2|ora)"))) : 
  ... must contain names or character strings

I think the pattern option doesn't support != ? and is it possible to fix this?
Thank you,

	[[alternative HTML version deleted]]

More information about the R-help mailing list