Toni Pitcher schrieb:


This works to some extent, all As have been changes to Cs, but the Bs have also been changed, in this case to "2", instead of remaining as their original values. How do I get the Bs to stay the same?
You should consult some introductory tutorial dealing with Rs way of treating vectors and especially indexing ("An untroduction to R" would be a good start). What kind of R object is data$Group ? (class(data$Group) ) ...If it is a character vector I would use logical indexing:

data$Group[data$Group=='A']=='C'


Second problems is similar;

I need to change some of the Subject IDs. The required format is 3 numbers followed by 3 letters (999LLL). Some of the IDs have format 999LLL-LL, Thus I need to delete the -LL from the IDs.
How do I generically specify "find 999LLL-LL and replace with 999LLL"?
What do you mean by IDs? Rownames?

Generally charcter replacement works with:

?sub



HTH
Jannis


Many thanks in advance

Toni





______________________________________________
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