zoukankan      html  css  js  c++  java
  • R语言学习笔记-变量的作用域

    R语言是如何将变量值和变量绑定的

    在r语言中,当前的 workspace就是global enviroment,当输入变量名时,首先会在global enviroment中搜索该变量,如有,则将它显示出来。

    第二步,如在global enviroment中没有找到该变量民,则搜索search list中的各个包,search list 中的内容可以用search()得到

    如果用户使用library()load了一个package ,则这个package将在search list中处于第二的位置

    Lexical scoping in R means that:

    the values of free variables are searched for in the environment in which the function
    was defined.

    If the value of a symbol is not found in the environment in which a function was defined,
    then the search is continued in the parent environment.
    • The search continues down the sequence of parent environments until we hit the top-level
    environment; this usually the global environment (workspace) or the namespace of a package.
    • After the top-level environment, the search continues down the search list until we hit the
    empty environment.

    If a value for a given symbol cannot be found once the empty environment is arrived at, then an
    error is thrown.

  • 相关阅读:
    每周总结
    4月9日学习日志
    4月8日学习日志
    4月7日学习日志
    4月6日学习日志
    Cypress存取时间为10纳秒的异步SRAM
    超低功耗MCU如何降低功耗
    集成铁电存储器MCU为物联网应用提供出色性能
    读取优先和SRAM-MRAM混合结构
    磁阻式随机存储器MRAM基本原理
  • 原文地址:https://www.cnblogs.com/wpzy2311/p/4600745.html
Copyright © 2011-2022 走看看