Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

factor in r

# This returns a character vector, the as.numeric() function
# is still required to convert the values to the proper type (numeric).
f <- levels(f)[f]
f <- as.numeric(f)
Source by swcarpentry.github.io #
 
PREVIOUS NEXT
Tagged: #factor
ADD COMMENT
Topic
Name
9+4 =