O'Reilly logo

R Data Mining by Andrea Cirillo

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

Data type checks with str()

We are going to leverage here the str() function, which we already met some paragraphs ago. We employed this function to get a closer look at our data frame, and we already noticed that it results in a list of vectors, each of which shows the name of a different column, the type of that column (even if we would better say the type of the vector forming that column), and the first ten records of it. We are now going to try to look more carefully through the output and see if some kind of strange result appears:

str(clean_stored_data)

This will result in:

'data.frame': 27060 obs. of  15 variables: $ attr_3         : num  0 0 0 0 0 0 0 0 0 0 ... $ attr_4         : num  1 1 1 1 1 1 1 1 1 1 ... $ attr_5         : chr  "0" "0" "0" "0" ... $ attr_6 ...

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