# 7-4 List Components & Values

# Recreate the animals list

animals<-list(PetName="Gracie",   # Newlines make things readable
              AnimalType="Dog",
              Age=11,
              Weight=27.5,
              Alive=TRUE,
              Sex="Female",
              FamilyName="Nusbacher")

# Display list

animals

# Display the tags only

names(animals)

# Display the values only

unlist(animals)

# This returns a vector of characters - this can be
# checked using the class() function

class(unlist(animals))

# If all values of a list are numerical, unlist returns
# a vector of integers or numeric

class(unlist(list(1:20)))
class(unlist(list(1.5,2.3,3.6,1.9)))

# To drop the names either set names() to NULL or use unname()

unname(animals)

# Display list

animals
