Hi R experts

I have a couple of  quick question:

Q1
#my data
set.seed(12341)
SN <- 1:100
pool<- c(12,13,14, 23, 24, 34)
CT1<- sample(pool, 100, replace= TRUE)
 set.seed(1242)
CT2 <- sample(pool, 100, replace= TRUE)
 set.seed(142)
CT3 <- sample(pool, 100, replace= TRUE)
# the number of variables run to end of coulmn 20000
mydf <- data.frame(SN, CT1, CT2, CT3)

First question: how can I split 12 into 1  2, 13 into 1  3,  14 into 1  4?
What I am trying here is to split each number into two and make seperate
variable CT1a and CT1b, CT2a and CT2b, CT3a and CT3b.

 Tried with strsplit () but I believe this works with characters only

Q2
Is there any function that works in the same manner as find and replace
function MS excel. Just for example, if I want to replace all 1s in the
above data frame with "A", 2 with "B". Thus the number 12 will be converted
to "AB".  I tried with car but it very slow as I need to very large
dataframe.

Thanks;


-- 

Ram H

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

Reply via email to