An example would have helped to give you a better answer.  You can use 
characters in the "seq" argument of the for loop.  i.e

x=letters[1:4]
x
[1] "a" "b" "c" "d"

for(i in x) {print(i)}
[1] "a"
[1] "b"
[1] "c"
[1] "d"


Is this what you were looking for?

Francisco


>From: "Chia, Yen Lin" <[EMAIL PROTECTED]>
>To: <[email protected]>
>Subject: [R] Loop through factors without changing to numerics
>Date: Thu, 19 Jan 2006 16:42:00 -0800
>
>Hi all,
>
>
>
>If I want to write a for loop to loop through a set of factors, which
>are not coded in 1,2,3, for e.g in character, possible to write the for
>loop without changing  it to categorical variables?  I saw the manual
>mentions for loop will take a list, but I'm not sure how to create a
>list here.  Any input will be appreciated.  Thanks.
>
>
>
>Yen Lin
>
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>[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

______________________________________________
[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

Reply via email to