Check if data frame column is numeric or not in R

 Apply a function to each column of a data frame to check that is numeric or not. If return TRUE means numeric and if FALSE means non-numeric but this logic doesn't give right output incase of data frame


apply(dat, 2, function(x) is.numeric(x))

To check for particular column is numeric or not
is.numeric(Column Name)          or for example                 is.numeric(my_data$SIN_50MM)

No comments:

Post a Comment

7 Stages of Machine Learning - Framework Introduction

Framework Introduction 7 Stages Introduction Stage 1: Problem Definition Stage 2: Data Collection Stage 3: Data Preparation Stage 4: Data Vi...