O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing a variable to another type

If you examine the preceding str() output, you will also see that Length.of.Stay is currently defined as a factor. This will need to be transformed to a new variable by using the as.integer function. Transform it to an integer, and code a str() and summary() function to ensure that the transformation is correct:

los.int <- as.integer(Length.of.Stay)head(los.int)summary(los.int)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required