[R] Replacing text

Henrique Dallazuanna wwwhsd at gmail.com
Tue Mar 11 19:58:05 CET 2008


If the column is factor:

levels(DATA$x)[levels(DATA$x) == "Toyota2"] <- "Scion"

or character:

DATA$x[DATA$x == "Toyota2"] <- "Scion"



On 11/03/2008, Suran, Luciana @ Torto Wheaton Research
<Luciana.Suran at tortowheatonresearch.com> wrote:
> Sorry, another newbie question :-(
>
>
>
>
>
>  I loaded a data set with 10 rows and 30 columns. The first column is
>  characters for names of car manufacturers:
>
>
>
>  Jeep
>
>  Nissan
>
>  Toyota1
>
>  Toyota2
>
>  Etc.
>
>
>
>  How can I replace "Toyota2" with "Scion"?
>
>
>
>  Thanks again
>
>
>
>
>
>
>
>
>
>
>         [[alternative HTML version deleted]]
>
>  ______________________________________________
>  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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list