Ah yes, good point.

this was easy enough to write, it doesn't lose dimensions, and there's no
unnecessary complexity... unless you're passing in data frames, in which
you'll have to recombine them.

trim = function(x) gsub("^[[:space:]]+|[[:space:]]+$", "", x)
trimmer = function(x){
if(is.list(x)){
rapply(x, trim, how='replace')
}else{
trim(x)
}
}

tempobj = '   many spaces   '
tempvec = c(tempobj, tempobj)
templist = list(tempvec, tempvec)
tempdf = data.frame(x = tempvec, y = tempvec)

trimmer(tempobj)
trimmer(tempvec)
trimmer(templist)
trimmer(tempdf)



Thank you,
   Gene Leynes
_____________________________________________
*Data Scientist*
*Mobile: 312-498-7702
**http://www.linkedin.com/in/geneleynes
*
<http://goog_598053156>*http://geneorama.com/ <http://geneorama.com/%20>*



On Fri, Aug 3, 2012 at 4:14 PM, R. Michael Weylandt <
michael.weylandt@gmail.com> wrote:

> On Fri, Aug 3, 2012 at 3:36 PM, Gene Leynes <gleynes@gmail.com> wrote:
> > Rui,
> > Yes, that's exactly it, thanks!!
> > I wouldn't have thought of the "is.atomic".  I was going after a series
> of
> > tests for dimension and is.list.
> >
> >
>
> One other helpful function that I haven't seen anyone mention this far
> is  ? rapply [= recursive apply]
>
> Best,
> Michael
>

	[[alternative HTML version deleted]]

