'How to find the type of variables in a column in an imported table

Why does typeof output show list instead of num? I tried instead to write the Class function, add square brackets, change comma positions and it also does not help lines 23-25

enter image description here

r


Solution 1:[1]

Instead of typeof, you should useclass. To get all of the columns' classes at once, you can do

sapply(starwars, class)
       name      height        mass  hair_color  skin_color   eye_color  birth_year
"character"   "integer"   "numeric" "character" "character" "character"   "numeric" 
        sex      gender   homeworld     species       films    vehicles   starships 
"character" "character" "character" "character"      "list"      "list"      "list" 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1