I have introduced some character values in mtcars dataset. The class of variables become character due to coercion.
My requirement is to get numeric values as numeric class and let the character values stay in their actual form i.e character class. So that i don't face a problem in doing calculations.
I tried as.numeric(as.character(data)) as well but it converts character values to NA.
I'm currently getting results for variables like 'abc' 'dcb' '4' '2' '6'.
But i need something like following: abc dcb 4 2 6
Can somebody please figure it out. I shall be extremely thankful.
My codes are as follows:
bb<-rep(x = 'abc', times=11)
cc<-rep(x = 'dcb', times=11)
mtcars[1,]<-bb
mtcars[2,]<-cc