Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up some importFrom use #91

Merged
merged 2 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion r-package/policytree/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ importFrom(stats,predict)
importFrom(stats,rbinom)
importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(utils,type.convert)
useDynLib(policytree)
2 changes: 0 additions & 2 deletions r-package/policytree/R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#' @references Zhou, Zhengyuan, Susan Athey, and Stefan Wager. "Offline multi-action policy learning:
#' Generalization and optimization." arXiv preprint arXiv:1810.04778 (2018).
#' @export
#' @importFrom stats rnorm runif
gen_data_mapl <- function(n, p = 10, sigma2 = 4) {
if (p < 7) {
stop("This DGP requires more than 7 features. Supplied: ", p)
Expand Down Expand Up @@ -68,7 +67,6 @@ gen_data_mapl <- function(n, p = 10, sigma2 = 4) {
#' @return A list
#' @references Athey, Susan, and Stefan Wager. "Policy Learning With Observational Data." Econometrica 89.1 (2021): 133-161.
#' @export
#' @importFrom stats rbinom
gen_data_epl <- function(n, type = c("continuous", "jump")) {
p <- 10
type <- match.arg(type)
Expand Down
3 changes: 1 addition & 2 deletions r-package/policytree/R/policy_tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
#' print(values, digits = 2)
#' }
#' @export
#' @importFrom utils type.convert
policy_tree <- function(X, Gamma, depth = 2, split.step = 1, min.node.size = 1) {
n.features <- ncol(X)
n.actions <- ncol(Gamma)
Expand Down Expand Up @@ -108,7 +107,7 @@ policy_tree <- function(X, Gamma, depth = 2, split.step = 1, min.node.size = 1)
if (is.null(action.names)) {
action.names <- as.character(1:ncol(Gamma))
}
action.names <- type.convert(action.names, as.is = TRUE) # TRUE to not convert character to factor
action.names <- utils::type.convert(action.names, as.is = TRUE) # TRUE to not convert character to factor
columns <- colnames(X)
if (is.null(columns)) {
columns <- make.names(1:ncol(X))
Expand Down
2 changes: 2 additions & 0 deletions r-package/policytree/R/policytree-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@
#'
#' @useDynLib policytree
#' @importFrom Rcpp evalCpp
#' @importFrom stats predict
#' @importFrom stats rbinom rnorm runif
#' @keywords internal
"_PACKAGE"
1 change: 0 additions & 1 deletion r-package/policytree/R/scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#' c.forest <- grf::causal_forest(X, Y, W)
#' mu.hats <- conditional_means(c.forest)
#' }
#' @importFrom stats predict
#' @export
conditional_means <- function(object, ...) {
UseMethod("conditional_means")
Expand Down