R Under development (unstable) (2024-10-21 r87258 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## The setup seems to be quite messy, but it is so to enable use of this in > ## several ways as shown below. > > ## 1. "R CMD check" should be the most authoritative way to run the RUnit > ## tests for a developer. RUnit tests are issued during R CMD check of the > ## package due to example section of .runRUnitTests() function. If any test > ## fails or if there are any R errors during RUnit testing, R CMD check fails. > ## These are variable values specific for this way: > ## - .path DEVEL/PATH/PKG.Rcheck/PKG/unitTests > ## - .way function > > ## 2. Running ".runRUnitTests()" from within R after library(PKG) is handy for > ## package useRs, since it enables useRs to be sure that all tests pass for > ## their installation. This is just a convenient wrapper function to run > ## the RUnit testing suite. These are variable values specific for this > ## way: > ## - .path INSTALL/PATH/PKG/unitTests > ## - .way function > > ## 3. The "Shell" is another possibility, mainly for a developer in order to > ## skip possibly lengthy R CMD check and perform just RUnit testing with an > ## installed version of a pcakage. These are variable values specific for > ## this way: > ## - .path DEVEL/PATH/PKG/inst/unitTests > ## - .way shell > ## > ## Rscript runRUnitTests.R > ## R CMD BATCH runRUnitTests.R > ## make > ## make all > > PKG <- "gdata" > > if(require("RUnit", quietly=TRUE)) { + path <- normalizePath("unitTests") + + cat("\nRunning unit tests\n") + print(list(pkg=PKG, getwd=getwd(), pathToUnitTests=path)) + + library(package=PKG, character.only=TRUE) + + testFileRegexp <- "^runit.+\\.[rR]$" + + ## Debugging echo + cat("\nRunning RUnit tests\n") + print(list(pkg=PKG, getwd=getwd(), pathToRUnitTests=path)) + + ## Define tests + testSuite <- defineTestSuite(name=paste(PKG, "RUnit testing"), dirs=path, + testFileRegexp=testFileRegexp) + + ## Run + tests <- runTestSuite(testSuite) + + if(file.access(path, 02) != 0) { + ## Cannot write to path -> use writable one + tdir <- tempfile(paste(PKG, "RUnitTests", sep="_")) + dir.create(tdir) + pathReport <- file.path(tdir, "report") + } else { + pathReport <- file.path(path, "report") + } + + ## Print results: + printTextProtocol(tests) + printTextProtocol(tests, fileName=paste0(pathReport, ".txt")) + + ## Print HTML Version of results: + printHTMLProtocol(tests, fileName=paste0(pathReport, ".html")) + + cat("\nRUnit reports also written to\n", + pathReport, ".(txt|html)\n\n", sep="") + + ## Return stop() to cause R CMD check stop in case of + ## - failures i.e. FALSE to RUnit tests or + ## - errors i.e. R errors + tmp <- getErrors(tests) + if(tmp$nFail > 0 || tmp$nErr > 0) { + stop("\n\nRUnit testing failed:\n", + " - #test failures: ", tmp$nFail, "\n", + " - #R errors: ", tmp$nErr, "\n\n") + } + } else { + cat("R package 'RUnit' cannot be loaded - no unit tests run\n", + "for package", PKG, "\n") + } Running unit tests $pkg [1] "gdata" $getwd [1] "d:/RCompile/CRANincoming/R-devel/gdata.Rcheck/tests" $pathToUnitTests [1] "D:\\RCompile\\CRANincoming\\R-devel\\gdata.Rcheck\\tests\\unitTests" Attaching package: 'gdata' The following object is masked from 'package:stats': nobs The following object is masked from 'package:utils': object.size The following object is masked from 'package:base': startsWith Running RUnit tests $pkg [1] "gdata" $getwd [1] "d:/RCompile/CRANincoming/R-devel/gdata.Rcheck/tests" $pathToRUnitTests [1] "D:\\RCompile\\CRANincoming\\R-devel\\gdata.Rcheck\\tests\\unitTests" Executing test function test.bindData ... Error in bindData(x = 1:10, y = 1:10) : 'x' must be a data frame In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in bindData(x = matrix(1:10), y = matrix(1:10)) : 'x' must be a data frame done successfully. Executing test function test.cbindX ... done successfully. Executing test function test.drop.levels ... done successfully. Executing test function test.getDay ... Error in getDay.default(x = num) : 'getDay' can only be used on objects of a date/time class In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 3: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 4: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 5: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 6: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in getDay.default(x = cha) : 'getDay' can only be used on objects of a date/time class Error in getDay.default(x = fac) : 'getDay' can only be used on objects of a date/time class done successfully. Executing test function test.getHour ... Error in getHour.default(x = num) : 'getHour' can only be used on objects of a date/time class Error in getHour.default(x = cha) : 'getHour' can only be used on objects of a date/time class Error in getHour.default(x = fac) : 'getHour' can only be used on objects of a date/time class done successfully. Executing test function test.getMin ... Error in getMin.default(x = num) : 'getMin' can only be used on objects of a date/time class Error in getMin.default(x = cha) : 'getMin' can only be used on objects of a date/time class Error in getMin.default(x = fac) : 'getMin' can only be used on objects of a date/time class done successfully. Executing test function test.getMonth ... Error in getMonth.default(x = num) : 'getMonth' can only be used on objects of a date/time class Error in getMonth.default(x = cha) : 'getMonth' can only be used on objects of a date/time class Error in getMonth.default(x = fac) : 'getMonth' can only be used on objects of a date/time class done successfully. Executing test function test.getSec ... Error in getSec.default(x = num) : 'getSec' can only be used on objects of a date/time class Error in getSec.default(x = cha) : 'getSec' can only be used on objects of a date/time class Error in getSec.default(x = fac) : 'getSec' can only be used on objects of a date/time class done successfully. Executing test function test.getYear ... Error in getYear.default(x = num) : 'getYear' can only be used on objects of a date/time class Error in getYear.default(x = cha) : 'getYear' can only be used on objects of a date/time class Error in getYear.default(x = fac) : 'getYear' can only be used on objects of a date/time class done successfully. Executing test function test.cLevelsMap ... Error in c.listLevelsMap(x, sort = sort, recursive = TRUE) : can not combine integer "levelsMaps" In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry done successfully. Executing test function test.checkLevelsMap ... Error in gdata:::.checkLevelsMap(x = "A", method = "raw") : '"A"' must be  a named list Error in gdata:::.checkLevelsMap(x = list("A"), method = "raw") : 'list("A")' must be  a named list Error in gdata:::.checkLevelsMap(x = fMapInt, method = "class") : 'fMapInt' must be a "levelsMap" Error in gdata:::.checkListLevelsMap(x = map, method = "class") : 'map' must be a "listLevelsMap" Error in gdata:::.checkListLevelsMap(x = map1, method = "class") : 'map1' must be also a list of "levelsMap" done successfully. Executing test function test.mapLevels ... Error in mapLevels.default(1:3) : mapLevels can only be used on "factor" and "character" atomic 'x' Error in mapLevels.default(1.5) : mapLevels can only be used on "factor" and "character" atomic 'x' Error in mapLevels.list(l, combine = TRUE) : can not combine integer "levelsMaps" Error in mapLevels.default(X[[i]], ...) : mapLevels can only be used on "factor" and "character" atomic 'x' Error in mapLevels.default(X[[i]], ...) : mapLevels can only be used on "factor" and "character" atomic 'x' done successfully. Executing test function test.mapLevels<- ... Error in `mapLevels<-.default`(1.1, value = 2) : 'x' must be either: "integer", "character", "factor" Error in `mapLevels<-.default`(complex(1.1), value = 2) : 'x' must be either: "integer", "character", "factor" Error in `mapLevels<-.default`(as.character(f), value = fMapInt) : can not apply integer "levelsMap" to "character" Error in func() : object 'chaMapCha' not found Error in `mapLevels<-.default`(as.character(f), value = fMapFuzz) : all components of 'value' must be of the same class Error in `mapLevels<-.default`(as.integer(f), value = fMapFuzz) : all components of 'value' must be of the same class done successfully. Executing test function test.uniqueLevelsMap ... done successfully. Executing test function test.nPairs ... Error in nPairs(x = x) : 'x' must be a data.frame or a matrix In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in nPairs(x = table(x)) : 'x' must be a data.frame or a matrix done successfully. Executing test function test.reorder.factor ... done successfully. Executing test function test.trim ... done successfully. Executing test function test.trimSum ... Error in trimSum(matrix(1:10)) : 'x' must be a vector - for now In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 3: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 4: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 5: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 6: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in trimSum(data.frame(1:10)) : 'x' must be a vector - for now Error in trimSum(list(1:10)) : 'x' must be a vector - for now Error in trimSum(letters) : 'x' must be numeric Error in trimSum(x = 1:10, n = 11) : 'n' must be smaller than the length of x Error in trimSum(x = 1, n = 1) : 'n' must be smaller than the length of x done successfully. Executing test function test.NAToUnknown ... Error in NAToUnknown.default(xInt, unknown = unkC) : 'unknown' must be a single value In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry 3: new level is introduced: notAvail Error in NAToUnknown.default(xInt, unknown = unkL) : 'unknown' must be a single value Error in NAToUnknown.default(xCha, unknown = chaUnk1) : 'x' already has value "-" Error in NAToUnknown.factor(xFac, unknown = facLev) : 'x' already has level "A" Error in NAToUnknown.default(x = dots[[1L]][[3L]], unknown = dots[[2L]][[3L]], : 'unknown' must be a single value In addition: There were 11 warnings (use warnings() to see them) Error in NAToUnknown.default(x = dots[[1L]][[3L]], unknown = dots[[2L]][[3L]], : 'unknown' must be a single value Error in .unknownList(x = x, unknown = unknown) : can not propely recycle named 'unknown' In addition: There were 16 warnings (use warnings() to see them) Error in .unknownList(x = x, unknown = unknown) : can not propely recycle named 'unknown' In addition: Warning messages: 1: 'unknown' should be "integer" for "integer" 'x' - will try to coerce 2: 'unknown' should be "numeric" for "numeric" 'x' - will try to coerce 3: new level is introduced: notAvail Error in .unknownList(x = x, unknown = unknown) : can not propely recycle named 'unknown' In addition: Warning messages: 1: 'unknown' should be "integer" for "integer" 'x' - will try to coerce 2: 'unknown' should be "numeric" for "numeric" 'x' - will try to coerce 3: new level is introduced: notAvail Error in .unknownList(x = x, unknown = unknown) : name(s) '' not in names of 'x' In addition: There were 16 warnings (use warnings() to see them) done successfully. Executing test function test.isUnknown ... Error in .unknownList(x = x, unknown = unknown) : name(s) '' not in names of 'x' In addition: Warning message: 'unknown' should be "matrix" for "matrix" 'x' - will try to coerce done successfully. Executing test function test.unknownToNA ... Error in .unknownList(x = x, unknown = unknown) : can not propely recycle named 'unknown' Error in .unknownList(x = x, unknown = unknown) : can not propely recycle named 'unknown' Error in .unknownList(x = x, unknown = unknown) : can not propely recycle named 'unknown' Error in .unknownList(x = x, unknown = unknown) : name(s) '' not in names of 'x' done successfully. Executing test function test.wideByFactor ... Error in wideByFactor(x = 1:10) : 'x' must be a data frame In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in wideByFactor(x = matrix(1:10)) : 'x' must be a data frame Error in wideByFactor(x = tmp, factor = c("f1", "f2")) : 'factor' can be only of length one Error in wideByFactor(x = tmp, factor = "c1") : column defined in 'factor' must be a factor done successfully. Executing test function test.write.fwf ... Error in write.fwf(1:10) : 'x' must be a data.frame or matrix In addition: Warning messages: 1: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: Marsaglia-Multicarry has poor statistical properties 2: In RNGkind(kind = testSuite$rngKind, normal.kind = testSuite$rngNormalKind) : RNGkind: severe deviations from normality for Kinderman-Ramage + Marsaglia-Multicarry Error in write.fwf(list(1:10)) : 'x' must be a data.frame or matrix Error in write.fwf(data.frame(1:10, letters[1:10]), na = c("", " ")) : only single value can be defined for 'na' num1 num2 1 2 1.0 3 1.5 4 2.0 5 2.5 6 3.0 7 3.5 8 4.0 9 4.5 10 5.0 5.5 num1 num2 1 2 1.0 3 1.5 4 2.0 5 2.5 6 3.0 7 3.5 8 4.0 9 4.5 10 5.0 5.5 a b c d 123 3.141593 1e+08 1e+222 int1 1 2 3 4 4 5 6 7 8 9 int1 1 2 3 4 1234 4 5 6 7 8 9 row num1 num2 1 1 2 2 1.0 3 3 1.5 4 4 2.0 5 5 2.5 6 6 3.0 7 7 3.5 8 8 4.0 9 9 4.5 10 10 5.0 11 5.5 row num1 num2 1 1 2 2 1.0 3 3 1.5 4 4 2.0 5 5 2.5 6 6 3.0 7 7 3.5 8 8 4.0 9 9 4.5 10 10 5.0 11 5.5 num1 num2 1 2 1.0 3 1.5 4 2.0 5 2.5 6 3.0 7 3.5 8 4.0 9 4.5 10 5.0 5.5 num1 num2 1 2 1.0 3 1.5 4 2.0 5 2.5 6 3.0 7 3.5 8 4.0 9 4.5 10 5.0 5.5 "num1" "num2" " 1" " " " 2" "1.0" " 3" "1.5" " 4" "2.0" " 5" "2.5" " 6" "3.0" " 7" "3.5" " 8" "4.0" " 9" "4.5" "10" "5.0" " " "5.5" "num1" "num2" " 1" " " " 2" "1.0" " 3" "1.5" " 4" "2.0" " 5" "2.5" " 6" "3.0" " 7" "3.5" " 8" "4.0" " 9" "4.5" "10" "5.0" " " "5.5" "num1" "num2" " 1" " " " 2" "1.0" " 3" "1.5" " 4" "2.0" " 5" "2.5" " 6" "3.0" " 7" "3.5" " 8" "4.0" " 9" "4.5" "10" "5.0" " " "5.5" "num1" "num2" " 1" " " " 2" "1.0" " 3" "1.5" " 4" "2.0" " 5" "2.5" " 6" "3.0" " 7" "3.5" " 8" "4.0" " 9" "4.5" "10" "5.0" " " "5.5" num1 1 2 3 4 5 6 7 8 9 10 num1 1 2 3 4 5 6 7 8 9 10 Error in write.fwf(testData[, c("num1", "num2")], width = 2) : 'width' (2) was too small for columns: num2 'width' should be at least (3) In addition: Warning message: In write.fwf(testData[, c("num1", "num2")], width = 2) : recycling 'width' Error in write.fwf(testData[, c("num1", "num2")], width = c(2, 1)) : 'width' (1) was too small for columns: num2 'width' should be at least (3) DONE. done successfully. RUNIT TEST PROTOCOL -- Tue Oct 22 06:05:05 2024 *********************************************** Number of test functions: 23 Number of errors: 0 Number of failures: 0 1 Test Suite : gdata RUnit testing - 23 test functions, 0 errors, 0 failures Details *************************** Test Suite: gdata RUnit testing Test function regexp: ^test.+ Test file regexp: ^runit.+\.[rR]$ Involved directory: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.bindData.R test.bindData: (11 checks) ... OK (0.03 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.cbindX.R test.cbindX: (5 checks) ... OK (0.02 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.drop.levels.R test.drop.levels: (3 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.getDateTimeParts.R test.getDay: (6 checks) ... OK (0 seconds) test.getHour: (3 checks) ... OK (0 seconds) test.getMin: (3 checks) ... OK (0 seconds) test.getMonth: (6 checks) ... OK (0 seconds) test.getSec: (3 checks) ... OK (0 seconds) test.getYear: (6 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.mapLevels.R test.cLevelsMap: (8 checks) ... OK (0 seconds) test.checkLevelsMap: (5 checks) ... OK (0 seconds) test.mapLevels: (26 checks) ... OK (0.02 seconds) test.mapLevels<-: (19 checks) ... OK (0.01 seconds) test.uniqueLevelsMap: (1 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.nPairs.R test.nPairs: (8 checks) ... OK (0.02 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.reorder.factor.R test.reorder.factor: (5 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.trim.R test.trim: (5 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.trimSum.R test.trimSum: (10 checks) ... OK (0.01 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.unknown.R test.NAToUnknown: (44 checks) ... OK (0.03 seconds) test.isUnknown: (38 checks) ... OK (0.02 seconds) test.unknownToNA: (40 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.wideByFactor.R test.wideByFactor: (10 checks) ... OK (0 seconds) --------------------------- Test file: D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/runit.write.fwf.R test.write.fwf: (22 checks) ... OK (0.06 seconds) RUnit reports also written to D:\RCompile\CRANincoming\R-devel\gdata.Rcheck\tests\unitTests/report.(txt|html) > > proc.time() user system elapsed 0.48 0.21 0.67