why dont factor done get change into numeric value in r code example
Example 1: R factors as numeric
as.numeric(levels(f))[f] # f being the factor column
Example 2: r - transform as factor
df$myvar <- as.numeric(as.character(df$myvar))
df$myvar <- as.factor(df$myvar)