Learn R Programming

SciencesPo (version 1.02.12)

destring: Convert Factors into Numeric Vectors

Description

Convert Factors into Numeric Vectors

Usage

destring(x)

Arguments

x
a factor whose levels will be converted.

encoding

UTF-8

Examples

Run this code
mylevels <- c('Strongly Disagree', 'Disagree', 'Neither', 'Agree', 'Strongly Agree')
myvar <- factor(sample(mylevels[1:5], 10, replace=TRUE))
unclass(myvar) # testing order
destring(myvar)

Run the code above in your browser using DataLab