TGS wrote:
To clarify, I'd like to create a column of indicators for the
respective letters so that I could maybe do regression on indicators,
etc.

For instance, "A" gets "1", "B" gets "2", and so on.

That's precisely how factors are handled by modeling functions in R!
No need to reinvent the wheel.  You should probably read a document
or book describing introductory regression methods in R.


On Aug 13, 2010, at 10:19 AM, David Winsemius wrote:


On Aug 13, 2010, at 1:03 PM, TGS wrote:

# how would I code in R to look at the letter of the alphabet # in
the second column and create a indicator column for the #
corresponding letter?

data(InsectSprays) InsectSprays$spray

It's already what most people mean when they say "indicator column",
i.e., a factor variable (and not a character vector) .... so,  what
do _you_ mean?



______________________________________________
R-help@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.

Reply via email to