aedin culhane <[EMAIL PROTECTED]> writes:

> Dear R-Help
> I am running apply on a data.frame containing factors and numeric 
> columns.  It appears to convert are columns into as.character? Does it 
> convert data.frame into matrix? Is this expected? I wish it to recognise 
> numerical columns and round numbers.  Can I use another function instead 
> of apply, or should I use a for loop in the case?

If you want to modify the data.frame object, a for loop will likely be
the best bet.  As noted in other replies, lapply will operate on the
columns of a data.frame since a data.frame is a list.  But the return
value will be a list, not a data.frame.

I think for loops get a bad wrap.  There are times when they are
appropriate and even optimal in R programming.

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to