Declaring a Const Variable in R

前端 未结 6 1004
耶瑟儿~
耶瑟儿~ 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:23

    Since you are planning to distribute your code to others, you could (should?) consider to create a package. Create within that package a NAMESPACE. There you can define variables that will have a constant value. At least to the functions that your package uses. Have a look at Tierney (2003) Name Space Management for R

提交回复
热议问题