I'm using R in Azure databricks in Standard DS3 V2 . I have a R data frame, train, which looks like
head(train,5)
Loc Date Consumption
Lon 2020-12-01 47%
Lon 2020-12-02 30%
Lon 2020-12-03 50%
Lon 2020-12-04 50%
Lon 2020-12-04 50%
But the consumption column is factor data type. I'm trying to convert consumption column to numeric data type. So I wrote following code
train$Consumption1=as.numeric(train[, 3])/100
Divided it by 100 as before divide it was not coming fractional Now my data is looking like this
head(train,5)
Loc Date Consumption Consumption1
Lon 2020-12-01 47% 0.44
Lon 2020-12-02 30% 0.26
Lon 2020-12-03 50% 0.48
Lon 2020-12-04 50% 0.48
Lon 2020-12-04 50% 0.48
Can you suggest me how to convert Consumption as numeric data without changing it's value?