Declaring a Const Variable in R

前端 未结 6 990
耶瑟儿~
耶瑟儿~ 2020-12-05 00:07

I\'m working in R, and I\'d like to define some variables that I (or one of my collaborators) cannot change. In C++ I\'d do this:

const std::string path( \"/         


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 00:42

    See lockBinding:

    a <- 1
    lockBinding("a", globalenv())
    a <- 2
    Error: cannot change value of locked binding for 'a'
    

提交回复
热议问题