LoslegenKostenlos loslegen

Creating and exploring environments

Environments are used to store other variables. Mostly, you can think of them as lists, but there's an important extra property that is relevant to writing functions. Every environment has a parent environment (except the empty environment, at the root of the environment tree). This determines which variables R know about at different places in your code.

Facts about the Republic of South Africa are contained in capitals, national_parks, and population.

Diese Übung ist Teil des Kurses

Introduction to Writing Functions in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Add capitals, national_parks, & population to a named list
rsa_lst <- ___(
  capitals = ___,
  ___ = ___,
  ___ = ___
)

# List the structure of each element of rsa_lst
___
Code bearbeiten und ausführen