Taraxacum88 wrote: > why > > rm(list=ls(all=TRUE),envir=globalenv()) > > is ok but > > ca<-function() rm(list=ls(all=TRUE),envir=globalenv()) > ca() > > does not work? ls(all=TRUE) from within your function lists all local variables, not globals. You need envir=globalenv() there too. Duncan Murdoch