[R] stupid R tricks

Carl Witthoft carl at witthoft.com
Sun Nov 7 17:40:47 CET 2010


Hi all,
Just thought I'd post this (maybe) helpful tool I wrote.  For people 
like me who are bad at keeping a clean environment, it's a time-saver.

#simple command to get only one type of object in current environment
lstype<-function(type='closure'){
	inlist<-ls(.GlobalEnv)
	if (type=='function') type <-'closure'
	typelist<-sapply(sapply(inlist,get),typeof)
	return(names(typelist[typelist==type]))
}



Carl



More information about the R-help mailing list