Shea
Shea

Reputation: 1

Dataframe consisting of mixed class, how to convert that into numerical in R

Tried this code sapply(df,function(x) as.numeric(as.character(x))), gives an error and is removing all the observation

Upvotes: 0

Views: 30

Answers (1)

Mohamed Desouky
Mohamed Desouky

Reputation: 4425

Try this

df[] <- lapply(df , as.numeric)

Upvotes: 1

Related Questions