Mismatch of structure of captaincy data
Title
Question
spoken tutorial video shows data type of name is factor, however actual processing shows it to character. rectification in the code file is needed.
R Data-types-and-Factors 07-08 min 30-40 sec
Answers:
We have checked the structure of captaincy. It shows as given below:
> str(captaincy)
'data.frame':<span style="white-space:pre"> </span>6 obs. of 9 variables:
$ names : Factor w/ 6 levels "Azhar","Dravid",..: 1 2 3 4 5 6
$ Y : int 2000 2008 2012 1965 2004 1980
$ played : int 47 25 45 40 49 47
$ won : int 14 8 22 9 21 9
$ lost : int 14 6 12 19 13 8
$ victory: num 0.298 0.32 0.489 0.225 0.429 ...
$ drawn : int 19 11 11 12 15 30
$ defeat : num 0.298 0.24 0.267 0.475 0.265 ...
$ formats: int 2 2 3 1 2 2
In the code file, we have only loaded the dataset. In case you are getting it as a character, you need not convert the name to the character.
Login to add comment