Hi,
You may try:
dat2 <- 
data.frame(col1=data,col2=as.character(factor(data,labels=c("positive","negative"))),stringsAsFactors=FALSE)


A.K.


Hello all, 

I have a data something like this; 

data<- c("a", "b","b","b","a","a","b","a","b") 

and I need to represent all "a"'s as "positive"  and "b"'s "negative" in 
data.frame something like this; 

data.frame output= 
col1  col2 
a     positive 
b     negative 
b     negative 
b     negative 
a     positive 
a     positive 
b     negative 
a     positive 
b     negative 

Thanks in advance for your solutions 

Thanks 
karthick

______________________________________________
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