fix some warning in Cran check

This commit is contained in:
pommedeterresautee
2015-02-09 21:34:53 +01:00
parent a3cf30592f
commit f4b454d6dd
2 changed files with 31 additions and 4 deletions

View File

@@ -52,13 +52,13 @@ xgb.dump <- function(model = NULL, fname = NULL, fmap = "", with.stats=FALSE) {
dt <- fread(paste(longString, collapse = ""), sep = "\n", header = F)
setnames(dt, "Content")
setnames(dt, "Lines")
if(is.null(fname)) {
result <- dt[Content != "0"][,Content := str_replace(Content, "^\t+", "")][Content != ""][,paste(Content)]
result <- dt[Lines != "0"][, Lines := str_replace(Lines, "^\t+", "")][Lines != ""][, paste(Lines)]
return(result)
} else {
result <- dt[Content != "0"][Content != ""][,paste(Content)] %>% writeLines(fname)
result <- dt[Lines != "0"][Lines != ""][, paste(Lines)] %>% writeLines(fname)
return(TRUE)
}
}
@@ -66,4 +66,4 @@ xgb.dump <- function(model = NULL, fname = NULL, fmap = "", with.stats=FALSE) {
# Avoid error messages during CRAN check.
# The reason is that these variables are never declared
# They are mainly column names inferred by Data.table...
globalVariables(".")
globalVariables(c("Lines", "."))