diff --git a/R/dataset.R b/R/dataset.R index ed014ed..e06cd30 100644 --- a/R/dataset.R +++ b/R/dataset.R @@ -1,4 +1,4 @@ -loadCorrectDataset <- function(x, nrows = -1) { +loadCorrectDataset <- function(x) { if (is.matrix(x) || is.data.frame(x)) { return(x) } else if (is.character(x)) { @@ -8,10 +8,7 @@ loadCorrectDataset <- function(x, nrows = -1) { # check if it's a path to a file if (file.exists(x)) { - dataset <- utils::read.csv(x, header = TRUE, check.names = FALSE, stringsAsFactors = TRUE, nrows = nrows) - if (nrows == 0) - return(dataset[0, , drop = FALSE]) - return(dataset) + return(utils::read.csv(x, header = TRUE, check.names = FALSE, stringsAsFactors = TRUE, nrows = nrows)) } # check if it's a name of a JASP dataset @@ -27,8 +24,7 @@ loadCorrectDataset <- function(x, nrows = -1) { if (length(match) > 1) { warning("Multiple datasets exists with the same name, choosing '", datasets[match[1]], "'") } - return(data.table::fread(fullPath, header = TRUE, check.names = FALSE, data.table = FALSE, - nrows = if (nrows == -1) Inf else nrows)) + return(data.table::fread(fullPath, header = TRUE, check.names = FALSE, data.table = FALSE)) } allDatasets <- c(allDatasets, basename(datasets)) diff --git a/R/run.R b/R/run.R index be34eb5..8d93946 100644 --- a/R/run.R +++ b/R/run.R @@ -138,9 +138,8 @@ initAnalysisRuntime <- function(dataset, options, makeTests, ...) { # first we reinstall any changed modules in the personal library reinstallChangedModules() - preloadDataset(dataset, options) # dataset to be found in the analysis when it needs to be read - # .setInternal("dataset", dataset) + preloadDataset(dataset, options) # prevent the results from being translated (unless the user explicitly wants to) Sys.setenv(LANG = getPkgOption("language"))