Hi Mike and Gabor - thx for the help.

It seams I have made a mistake in my original question. While Mike's
solutions worked on the example data I provided, I now see my actual data is


> is(df100_lang$gray)
[1] "character"           "vector"              "data.frameRowLabels"

and the solution doesn't work.

I am sorry for posting the wrong data. If you'd still like to help this is
the original data: Thanks for the help (and patience!)

df100_lang$gray <- structure(c("gray0", "gray3", "gray7", "gray10",
"gray14", "gray17",
"gray21", "gray24", "gray28", "gray31", "gray35", "gray38", "gray42",
"gray45", "gray48", "gray52", "gray55", "gray59", "gray62", "gray66",
"gray69", "gray73", "gray76", "gray80", "gray83", "gray87", "gray90",
"gray0", "gray3", "gray7", "gray10", "gray14", "gray17", "gray21",
"gray24", "gray28", "gray31", "gray35", "gray38", "gray42", "gray45",
"gray48", "gray52", "gray55", "gray59", "gray62", "gray66", "gray69",
"gray73", "gray76", "gray80", "gray83", "gray87", "gray90", "gray0",
"gray3", "gray7", "gray10", "gray14", "gray17", "gray21", "gray24",
"gray28", "gray31", "gray35", "gray38", "gray42", "gray45", "gray48",
"gray52", "gray55", "gray59", "gray62", "gray66", "gray69", "gray73",
"gray76", "gray80", "gray83", "gray87", "gray90", "gray0", "gray3",
"gray7", "gray10", "gray14", "gray17", "gray21", "gray24", "gray28",
"gray31", "gray35", "gray38", "gray42", "gray45", "gray48", "gray52",
"gray55", "gray59", "gray62", "gray66", "gray69", "gray73", "gray76",
"gray80", "gray83", "gray87", "gray90", "gray0", "gray3", "gray7",
"gray10", "gray14", "gray17", "gray21", "gray24", "gray28", "gray31",
"gray35", "gray38", "gray42", "gray45", "gray48", "gray52", "gray55",
"gray59", "gray62", "gray66", "gray69", "gray73", "gray76", "gray80",
"gray83", "gray87", "gray90", "gray0", "gray3", "gray7", "gray10",
"gray14", "gray17", "gray21", "gray24", "gray28", "gray31", "gray35",
"gray38", "gray42", "gray45", "gray48", "gray52", "gray55", "gray59",
"gray62", "gray66", "gray69", "gray73", "gray76", "gray80", "gray83",
"gray87", "gray90", "gray0", "gray3", "gray7", "gray10", "gray14",
"gray17", "gray21", "gray24", "gray28", "gray31", "gray35", "gray38",
"gray42", "gray45", "gray48", "gray52", "gray55", "gray59", "gray62",
"gray66", "gray69", "gray73", "gray76", "gray80", "gray83", "gray87",
"gray90", "gray0", "gray3", "gray7", "gray10", "gray14", "gray17",
"gray21", "gray24", "gray28", "gray31", "gray35", "gray38", "gray42",
"gray45", "gray48", "gray52", "gray55", "gray59", "gray62", "gray66",
"gray69", "gray73", "gray76", "gray80", "gray83", "gray87", "gray90",
"gray0", "gray3", "gray7", "gray10", "gray14", "gray17", "gray21",
"gray24", "gray28", "gray31", "gray35", "gray38", "gray42", "gray45",
"gray48", "gray52", "gray55", "gray59", "gray62", "gray66", "gray69",
"gray73", "gray76", "gray80", "gray83", "gray87", "gray90", "gray0",
"gray3", "gray7", "gray10", "gray14", "gray17", "gray21", "gray24",
"gray28", "gray31", "gray35", "gray38", "gray42", "gray45", "gray48",
"gray52", "gray55", "gray59", "gray62", "gray66", "gray69", "gray73",
"gray76", "gray80", "gray83", "gray87", "gray90", "gray0", "gray3",
"gray7", "gray10", "gray14", "gray17", "gray21", "gray24", "gray28",
"gray31", "gray35", "gray38", "gray42", "gray45", "gray48", "gray52",
"gray55", "gray59", "gray62", "gray66", "gray69", "gray73", "gray76",
"gray80", "gray83", "gray87", "gray90"), .Label = character(0))



On Sun, May 24, 2009 at 2:12 PM, Gabor Grothendieck <ggrothendieck@gmail.com
> wrote:

> Try storing them as character strings rather than factors:
>
> black_gray <- data.frame(black, gray, stringsAsFactors = FALSE)
>
> Try this to view what you've got:
>
> str(black_gray)
>
> On Sun, May 24, 2009 at 7:15 AM, Andreas Christoffersen
> <achristoffersen@gmail.com> wrote:
> > Hi,
> >
> > In the example dataset below - how can I cahnge "gray20", to "blue"
> >
> > # data
> > black <- rep(c("black","red"),10)
> > gray <- rep(c("gray10","gray20"),10)
> > black_gray <- data.frame(black,gray)
> >
> > # none of this desperate things works
> > # replace(black_gray$gray, gray=="gray20","red")
> > # if(black_gray$gray=="gray20"){black_gray$gray<-"blue"}
> > # for (i in
> > black_gray$gray)if(black_gray$gray[i]=="gray20"){black_gray$gray[i]
> > <-"blue"}
> > # black_gray$gray=="gray14" <- "blue"
> > # black_gray$gray[gray=="gray20"] <- "blue"
> > # subset(black_gray,gray=="gray20",gray) <-rep("blue",10)
> >
> > I have a feeling this is me misunderstanding some very basic stuf about
> the
> > R engine... So any help will be much appreciated.
> >
> > Thanks in advance
> >
> > Andreas
> >
> >        [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
>

	[[alternative HTML version deleted]]


