Continuous variables

In linear regression, including logistic regression, it is straightforward to fit a regression model when the feature variables are continuous, as it just needs to find a linear combination of feature variables with numerical values for estimating the output variable. In order to fit a regression model with continuous variables, let's first take a look at how to get the data types of the columns in an R DataFrame. Take a look at the following code:

# get data types of each columnsapply(df, class)

Using the sapply function in R, we can apply the class function across the columns in a DataFrame, and the class function tells us the types of data in each column. The results of this code are as follows:

Shown in the preceding ...

Get Hands-On Data Science for Marketing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.