-3

I want to remove some of the variables, NOT all as remove() and rm would do.
In Matlab I'd wright:
clearvars -except Environnement Species *_species Latitude Longitude

braX
  • 11,506
  • 5
  • 20
  • 33
Labrini
  • 1
  • 5

1 Answers1

0

This is the best I can do. This creates a,b,c and deletes everything the the Global Env except for b.

a<-1
b<-2
c<-1:5
rm(list = ls()[!ls() %in% c("b")])
Jan Sila
  • 1,554
  • 3
  • 17
  • 36