เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Do variables exist?

If R cannot find a variable in the current environment, it will look in the parent environment, then the grandparent environment, and so on until it finds it.

rsa_env has been modified so it includes capitals and national_parks, but not population.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Introduction to Writing Functions in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Check if population exists in rsa_env, using default inheritance rules.
  • Check if population exists in rsa_env, ignoring inheritance.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Compare the contents of the global environment and rsa_env
ls.str(globalenv())
ls.str(rsa_env)

# Does population exist in rsa_env?
___("___", envir = ___)

# Does population exist in rsa_env, ignoring inheritance?
___
แก้ไขและรันโค้ด