SSCC - Social Science Computing Cooperative Supporting Statistical Analysis for Research

1.2 Functions, Packges, and Getting help

  1. Find out how to create an object with a class of list. There is a function in both R and Python to make a list object.

    A list is an object that holds an ordered set of values. List objects are included in the base functionality of both R and Python.

    List are useful stuctures in both R and Python. List objects and their uses will be explained further in later chapters.

    Set RStudio to python mode

    library(reticulate)
    repl_python()
    list_object = ["i",  52]
  2. Use the function you found in problem 1 to create a list object with only one item, an a, as the sequence of values. Name this list object my_list.

    my_list = ["a"]
  3. Display the contents of my_list.

    print(my_list)
    ['a']