R Under development (unstable) (2024-04-23 r86473 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. > require("sfsmisc") Loading required package: sfsmisc > > options(warn=2) > AsciiToInt(LETTERS) # gave '.. embedded nul ..' warning [1] 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 [26] 90 > > ## just for fun -- typically shows "iso-latin1 charset > cat(chars8bit(1:255),"\"\n")                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  " > > ## Checking the new 'ndigits' default argument for digitsBase(): > ee <- 0:30 > for(base in 2:64) + stopifnot((be <- base^ee) > 0, any(ok <- be < 2^52), + ee == floor(1e-9+ log(be, base)), + 0 == as.integer(digitsBase(0, base=base)), # failed + be[ok] == as.integer(digitsBase(be[ok], base=base))) > ## failed, e.g. for 3^5, in sfsmisc <= 1.0-22 > > ## Tests for is.whole (taken from the examples) > set.seed(307) > a <- array(runif(24), dim = c(2, 3, 4)) > a[4:8] <- 4:8 > m <- matrix(runif(12), 3, 4) > m[2:4] <- 2:4 > v <- complex(real = seq(0.5, 1.5, by = 0.1), + imaginary = seq(2.5, 3.5, by = 0.1)) > > ## Find whole entries > stopifnot(identical(is.whole(a), a == round(a)), + identical(is.whole(m), m == round(m)), + which(is.whole(v)) == 6) > > ## Numbers of class integer are always whole > stopifnot(is.whole(dim(a)), is.whole(length(v)), is.whole(-1L)) > > > ## From: Liping Seng > ## Subject: Bug with integrate.xy()? > ## Date: Wed, 7 Jun 2017 12:24:12 +0000 > ## MM simplified > set.seed(1776) > y <- rnorm(200) > fit <- density(y, bw = 0.3773427, n=1024, kernel="epanechnikov") > integrate.xy(fit$x, fit$y, min(fit$x), 1.7927854, xtol=3.16228e-7) [1] 0.9338978 > ## Fixed (2017-06-08) > ## Error in seq.default(a, length = max(0, b - a - 1)) : > ## 'length.out' must be a non-negative number > > proc.time() user system elapsed 0.12 0.10 0.21