Skip to content

Commit

Permalink
Tiny bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
oscpe436 committed Jan 6, 2016
1 parent d61cba7 commit a0f1314
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
36 changes: 34 additions & 2 deletions R/mark_my_assignment.R
Expand Up @@ -253,10 +253,42 @@ delete_circular_calls <- function(mark_file){
"mark_my_assignment", "mark_my_dir", "set_assignment", "mark_my_file",
"install.packages", "utils::install.packages",
"devtools::install_github", "install_github")
regex <- paste("(^|;| )", forbidden, "\\([^\\)]*\\)", sep = "")
regex <- paste("(^|;| )", forbidden, "\\(.*\\)", sep = "")
for(pattern in regex){
txt <- gsub(pattern = pattern, replacement = "", x = txt)
}
# change_list <- c("data")

# indices <- grep(pattern = "^data\\(.*\\)", x = txt, value = F)
# txt[indices] <- gsub(pattern = "^data\\(", replacement = "markmyassignment:::data_mma\\(", x = txt[indices])

return(txt)
}



#' @title
#' Loads a data set into a specific environment
#'
#' @description
#' Loads a data set into a specific environment
#'
#' @param ...
#' Arguments to pass on to data().
#' @param env
#' Environment to load data into.
#'
#' @return
#' One or more data sets are loaded into the specified environment
data_mma <- function(..., env ){ #= mark_my_env){
A <- list(...)
if( !any(names(A) == "envir") ){
data(..., envir = env)
}else if( !any(names(A) == "") ){
A$envir = env
do.call(what = data, args = A)
}else{
message("Not functional yet.")
}
}


20 changes: 20 additions & 0 deletions man/data_mma.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a0f1314

Please sign in to comment.