* using log directory ‘/Volumes/Builds/packages/big-sur-arm64/results/4.5/Ecfun.Rcheck’ * using R Under development (unstable) (2025-01-24 r87627) * using platform: aarch64-apple-darwin20 * R was compiled by Apple clang version 14.0.0 (clang-1400.0.29.202) GNU Fortran (GCC) 14.2.0 * running under: macOS Ventura 13.4 * using session charset: UTF-8 * checking for file ‘Ecfun/DESCRIPTION’ ... OK * this is package ‘Ecfun’ version ‘0.3-6’ * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘Ecfun’ can be installed ... [6s/7s] OK See 'https://www.r-project.org/nosvn/R.check/r-devel-macos-arm64/Ecfun-00install.html' for details. * checking installed package size ... OK * checking package directory ... OK * checking ‘build’ directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... [1s/2s] OK * checking whether the package can be loaded with stated dependencies ... [1s/1s] OK * checking whether the package can be unloaded cleanly ... [1s/1s] OK * checking whether the namespace can be loaded with stated dependencies ... [1s/1s] OK * checking whether the namespace can be unloaded cleanly ... [1s/1s] OK * checking loading without being on the library search path ... [1s/1s] OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [6s/7s] OK * checking Rd files ... [0s/0s] OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK * checking examples ... [2s/2s] ERROR Running examples in ‘Ecfun-Ex.R’ failed The error most likely occurred in: > ### Name: asNumericDF > ### Title: Coerce to numeric dropping commas and info after a blank > ### Aliases: asNumericChar asNumericDF > ### Keywords: manip > > ### ** Examples > > ## > ## 1. an example > ## > (xDate <- as.Date('1970-01-01')+c(0, 365)) [1] "1970-01-01" "1971-01-01" > (xPOSIX <- as.POSIXct(xDate)+c(1, 99)) [1] "1970-01-01 00:00:01 UTC" "1971-01-01 00:01:39 UTC" > xMSdate <- as.Date(1, + as.Date('1899-12-31'))+1:2 > (fakeF1 <- data.frame(yr=c('1948', + '1947 (1)'), + q1=c(' 1,234 ', ''), duh=rep(NA, 2), + dol=c('$1,234', ''), + pct=c('1%', '2%'), + xDate=format(xDate, '%Y-%m-%d'), + xPOSIX=format(xPOSIX, '%Y-%m-%d %H:%M:%S'), + xMSdate=2:3, junk=c('this is', + 'junk'))) yr q1 duh dol pct xDate xPOSIX xMSdate 1 1948 1,234 NA $1,234 1% 1970-01-01 1970-01-01 00:00:01 2 2 1947 (1) NA 2% 1971-01-01 1971-01-01 00:01:39 3 junk 1 this is 2 junk > > # This converts the last 3 columns to NAs and drops them: > > str(nF1.1 <- asNumericChar(fakeF1$yr)) num [1:2] 1948 1947 > str(nF1.2 <- asNumericChar(fakeF1$q1)) num [1:2] 1234 NA > str(nF1.3 <- asNumericChar(fakeF1$duh)) logi [1:2] NA NA > (nF1.4 <- asNumericChar('1969-12-31 18:00:01', + class.='POSIXct')) [1] "1969-12-31 06:00:01 UTC" > > (nF1 <- asNumericDF(fakeF1)) Warning in asNumericDF(fakeF1) : NAs introduced by coercion in asNumericChar(q1[2]) Warning in asNumericDF(fakeF1) : NAs introduced by coercion in asNumericChar(dol[2]) Warning in asNumericDF(fakeF1) : NAs introduced by coercion in asNumericChar(xDate[c(1, 2)]) Warning in asNumericDF(fakeF1) : NAs introduced by coercion in asNumericChar(xPOSIX[c(1, 2)]) Warning in asNumericDF(fakeF1) : NAs introduced by coercion in asNumericChar(junk[c(1, 2)]) yr q1 dol pct xMSdate 1 1948 1234 1234 0.01 2 2 1947 NA NA 0.02 3 > (nF2 <- asNumericDF(fakeF1, Dates=6, + MSdate='xMSdate', + ignore=c('junk', 'xPOSIX'), + format.='%Y-%m-%d')) Warning in asNumericDF(fakeF1, Dates = 6, MSdate = "xMSdate", ignore = c("junk", : NAs introduced by coercion in asNumericChar(q1[2]) Warning in asNumericDF(fakeF1, Dates = 6, MSdate = "xMSdate", ignore = c("junk", : NAs introduced by coercion in asNumericChar(dol[2]) yr q1 dol pct xDate xPOSIX xMSdate junk 1 1948 1234 1234 0.01 1970-01-01 1970-01-01 00:00:01 1900-01-02 this is 2 1947 NA NA 0.02 1971-01-01 1971-01-01 00:01:39 1900-01-03 junk > # check > nF1. <- data.frame(yr= + asNumericChar(fakeF1$yr), + q1=asNumericChar(fakeF1$q1), + dol=asNumericChar(fakeF1$dol), + pct=c(.01, .02), xMSdate=2:3) > > nF1c <- data.frame(yr=1948:1947, + q1=c(1234, NA), dol=c(1234, NA), + pct=c(.01, .02), xMSdate=2:3) > > ## Don't show: > stopifnot( + ## End(Don't show) + all.equal(nF1, nF1.) + ## Don't show: + ) > ## End(Don't show) > ## Don't show: > stopifnot( + ## End(Don't show) + all.equal(nF1., nF1c) + ## Don't show: + ) > ## End(Don't show) > > ## > ## 2. as.Date default example > ## > xD <- asNumericChar( + as.character(xDate), class.='Date') > ## Don't show: > stopifnot( + ## End(Don't show) + all.equal(xDate, xD) + ## Don't show: + ) > ## End(Don't show) > > ## > ## 3. as.POSIXct default example > ## > xPOSIX [1] "1970-01-01 00:00:01 UTC" "1971-01-01 00:01:39 UTC" > (xPOSIXch <- as.character(xPOSIX)) [1] "1970-01-01 00:00:01" "1971-01-01 00:01:39" > (xP <- asNumericChar(xPOSIXch, class.='POSIXct')) [1] "1969-12-31 12:00:01 UTC" "1970-12-31 12:01:39 UTC" > attr(xPOSIX, 'tzone') [1] "UTC" > attr(xP, 'tzone') [1] "UTC" > # R-Devel after 4.2.1 breaks earlier code; fix > if(is.null(attr(xPOSIX, 'tzone'))) + attr(xPOSIX, 'tzone') <- attr(xP, 'tzone') > (dP <- difftime(xPOSIX, xP, units='secs')) Time differences in secs [1] 43200 43200 > (madP <- max(abs(as.numeric(dP)))) [1] 43200 > ## Don't show: > stopifnot( + ## End(Don't show) + { + #all.equal(xPOSIX, xP) + # As of 2022-10-06 I don't know how to write code + # that will get a consistent answer with + # different version R-devel with differences + # less than an hour + if(madP>(6*60*60)){ + madPmsg <- paste('Discrepancy betw fn and manual comp ', + 'too large; is ', madP, 'seconds') + stop(madPmsg) + } + TRUE + } + ## Don't show: + ) Error in stopifnot({ : Discrepancy betw fn and manual comp too large; is 43200 seconds Execution halted * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... OK * checking re-building of vignette outputs ... [20s/23s] OK * checking PDF version of manual ... [7s/8s] OK * DONE Status: 1 ERROR * using check arguments '--no-clean-on-error ' * elapsed time (check, wall clock): 1:25