Need helping creating a loop in R. Have many similarly named variables I have to apply the same func

Posted by user335897 on Stack Overflow See other posts from Stack Overflow or by user335897
Published on 2010-05-07T23:18:48Z Indexed on 2010/05/07 23:28 UTC
Read the original article Hit count: 429

Filed under:
|
|
|

I am using a dataset w/variables that have very similar names. I have to apply the same functions to 13 variables at a time and I'm trying to shorten the code, instead of doing each variable individually.

q01a.F=factor(q01a)

q01b.F=factor(q01b)

q01c.F=factor(q01c)

q01d.F=factor(q01d)

q01e.F=factor(q01e)

q01f.F=factor(q01f)

q01g.F=factor(q01g)

q01h.F=factor(q01h)

q01i.F=factor(q01i)

q01j.F=factor(q01j)

q01k.F=factor(q01k)

q01l.F=factor(q01l)

q01m.F=factor(q01m)

Suggestions?

© Stack Overflow or respective owner

Related posts about r

    Related posts about code-statistics