A list of lists can represent several records without forcing every field into one vector type.

Program

Play the script to choose a record and show its name plus score.

nested_records.R
student_index <- 
records <- list(list(name = "Ana", score = 80), list(name = "Bo", score = 92), list(name = "Cy", score = 75))
student <- records[[student_index]]
label <- paste(student$name, student$score, sep = ":")
cat(label, "\n", sep = "")
student_index <- 
records <- list(list(name = "Ana", score = 80), list(name = "Bo", score = 92), list(name = "Cy", score = 75))
student <- records[[student_index]]
label <- paste(student$name, student$score, sep = ":")
cat(label, "\n", sep = "")
student_index <- 
records <- list(list(name = "Ana", score = 80), list(name = "Bo", score = 92), list(name = "Cy", score = 75))
student <- records[[student_index]]
label <- paste(student$name, student$score, sep = ":")
cat(label, "\n", sep = "")
nested list A list can contain another list for each record.
record selection `records[[student_index]]` chooses one full record.
field access `student$name` and `student$score` read fields inside the chosen record.