Re: [R] generating factors from the edit function

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Sat, 05 Mar 2011 01:56:44 -0800 (PST)

Erin Hodgess-2 wrote:
>
> Here is a little function that I put together:
>

>> fact1

> function(x) {
> n <- ncol(x)
> for(i in 1:n) {
> if(mode(x[,i])=="character")x[,i] <- factor(x[,i])
> }
> return(x)
> }
>>

>
>

See

http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg22459.html

for a more R-ish approach. I find the d[] <- an FFQ (frequently forgotten solution)

Dieter

--
View this message in context: http://r.789695.n4.nabble.com/generating-factors-from-the-edit-function-tp3336273p3336455.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org 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.
Received on Sat 05 Mar 2011 - 10:00:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 05 Mar 2011 - 14:20:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive