add get/set inst environment variables
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This allows the internal instrument to be handled as a regular environment object. It can be saved, exported, directly modified (not recommended), whatever.
This commit is contained in:
parent
76ad9b7659
commit
8b9215d9c0
|
@ -1,6 +1,6 @@
|
|||
Package: rcgen
|
||||
Title: Generate Chocies for Popular Experimental Economics Instruments
|
||||
Version: 0.12.3
|
||||
Version: 0.13.0
|
||||
Authors@R: person("Brian", "Monroe", email = "brianalbertmonroe@gmail.com", role = c("aut", "cre"))
|
||||
Description: Generates chocies from popular experimental economics instruments. This package makes simulated data that can then be used to test various estimation techniques.
|
||||
Depends:
|
||||
|
@ -11,4 +11,4 @@ Encoding: UTF-8
|
|||
LazyData: true
|
||||
Imports:
|
||||
rcest
|
||||
RoxygenNote: 7.0.2
|
||||
RoxygenNote: 7.1.1
|
||||
|
|
|
@ -4,4 +4,6 @@ export(avail_inst)
|
|||
export(gen_choice)
|
||||
export(gen_inst)
|
||||
export(get_inst)
|
||||
export(get_instenv)
|
||||
export(set_inst)
|
||||
export(set_instenv)
|
||||
|
|
19
R/inst_set.R
19
R/inst_set.R
|
@ -42,3 +42,22 @@ get_inst <- function(names) {
|
|||
avail_inst <- function() {
|
||||
ls(envir = premade_inst_env)
|
||||
}
|
||||
|
||||
#' @title Get the Private Inst Environment
|
||||
#'
|
||||
#' @export get_instenv
|
||||
get_instenv <- function() {
|
||||
return(premade_inst_env)
|
||||
}
|
||||
|
||||
#' @title Set the Private Inst Environment
|
||||
#'
|
||||
#' @param instenv the environment containing premade insts
|
||||
#' @export set_instenv
|
||||
set_instenv <- function(instenv) {
|
||||
# remove everything from the environment
|
||||
rm(list = ls(envir = premade_inst_env), envir = premade_inst_env)
|
||||
for (e in ls(envir = instenv)) {
|
||||
assign(e, instenv[[e]], envir = premade_inst_env)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/inst_set.R
|
||||
\name{get_instenv}
|
||||
\alias{get_instenv}
|
||||
\title{Get the Private Inst Environment}
|
||||
\usage{
|
||||
get_instenv()
|
||||
}
|
||||
\description{
|
||||
Get the Private Inst Environment
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/inst_set.R
|
||||
\name{set_instenv}
|
||||
\alias{set_instenv}
|
||||
\title{Set the Private Inst Environment}
|
||||
\usage{
|
||||
set_instenv(instenv)
|
||||
}
|
||||
\arguments{
|
||||
\item{instenv}{the environment containing premade insts}
|
||||
}
|
||||
\description{
|
||||
Set the Private Inst Environment
|
||||
}
|
Loading…
Reference in New Issue