Dyd666
Dyd666

Reputation: 21

Replacing strings with digits automatically

I have a pretty huge data frame with a column in which some personal emails are repeated hundred times, such as (please see figure below):

enter image description here

is there a function/package which can handle this automatically?

Thanks!

Upvotes: 2

Views: 27

Answers (1)

Jonas
Jonas

Reputation: 1810

Just try

x <- c("a","a","b","b","v","w") #your emails
numbers <- as.numeric(as.factor(x))

or

numbers <- match(x,unique(x))

Upvotes: 1

Related Questions