January 2018
Beginner to intermediate
422 pages
9h 47m
English
In the previous section we noticed some anomalies in the dataset. But before proceeding with any removal, additional control over the type attributed by R to the variables should be carried out. To do this, we will use the str() function that returns a compact display of the internal structure of an R object:
str(SampleData)
The results are shown in the following:
> str(SampleData)'data.frame': 12 obs. of 5 variables: $ name : Factor w/ 12 levels "Ava","Elijah",..: 3 5 11 9 1 7 4 6 12 2 ... $ gender: Factor w/ 3 levels "","F","M": 2 3 1 3 2 3 2 3 2 3 ... $ age : int 24 -19 32 15 18 21 28 30 26 100 ... $ right : Factor w/ 11 levels "-19",".","13",..: 9 2 8 7 4 6 1 3 11 10 ... $ wrong : int 20 47 25 40 55 46 85 87 30 2 ...
Read now
Unlock full access