save it back to num r coding 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)
as.numeric(levels(f))[f] # f being the factor column
df$myvar <- as.numeric(as.character(df$myvar))
df$myvar <- as.factor(df$myvar)