Displaying 20 results from an estimated 30000 matches similar to: "an assert() function"
2016 May 04
4
Is it possible to retrieve the last error? (not error *message*)
Hi,
at the R prompt, is it possible to retrieve the last error (as in
condition object of class "error")?
I'm not asking for geterrmessage(), which only returns the error
message (as a character string). I'm basically looking for a
.Last.error or .Last.condition, analogously to .Last.value for values,
which can be used when it is "too late" (not possible) to go back
2019 May 30
2
stopifnot
Here is a patch to function 'stopifnot' that adds 'evaluated' argument and makes 'exprs' argument in 'stopifnot' like 'exprs' argument in 'withAutoprint'.
--- stop.R 2019-05-30 14:01:15.282197286 +0000
+++ stop_new.R 2019-05-30 14:01:51.372187466 +0000
@@ -31,7 +31,7 @@
.Internal(stop(call., .makeMessage(..., domain = domain)))
}
2013 Aug 20
7
Extending suggestion for stopifnot
I am using a variant of stopifnot a lot. can I suggest that base R
extends its functionality? I know how to do this for myself. this is
a suggestion for beginners and students. I don't think it would break
anything.
first, I think it would be more useful if it had an optional character
string, so users could write
stopifnot( is.matrix(m), "m is not a matrix" )
this would
2020 Mar 13
7
pipe(): input to, and output from, a single process
hi. i'd like to instantiate sed(1), send it some input, and retrieve
its output, all via pipes (rather than an intermediate file).
my sense from pipe and looking at the sources (sys-unix.c) is that is
not possible. is that true? are there any thoughts of providing such a
facility?
cheers, Greg
2008 Sep 27
1
seg.fault from nlme::gnls() {was "[R-sig-ME] GNLS Crash"}
>>>>> "VW" == Viechtbauer Wolfgang (STAT) <Wolfgang.Viechtbauer at STAT.unimaas.nl>
>>>>> on Fri, 26 Sep 2008 18:00:19 +0200 writes:
VW> Hi all, I'm trying to fit a marginal (longitudinal)
VW> model with an exponential serial correlation function to
VW> the Orange tree data set. However, R crashes frequently
VW>
2011 Jul 11
1
EXTERNAL: Re: subset with aggregate key
Matthew Dowle wrote:
> Hi,
>
> Try package 'data.table'. It has a concept of keys which allows you to do
> exactly that.
>
> http://datatable.r-forge.r-project.org/
>
> Matthew
>
>
Hi Matthew,
Unfortunately, the load of that library fails (it builds successfully).
I'm currently looking into why. Error output looks something similar to:
>
2013 Feb 14
4
2 setGeneric's, same name, different method signatures
hi. below is a small test case (hopefully minimal, though i'm still a
bit confused about initializers).
i would have guessed (and maybe i still would have been right) that one
could re-use the name of a generic function for functions with different
numbers of arguments. in the case below, class A's bB() queries the
status of a single A object, so bB(A) (where here "A" is an
2005 Jul 08
5
Help with Mahalanobis
Dear R list,
I'm trying to calculate Mahalanobis distances for 'Species' of 'iris' data
as obtained below:
Squared Distance to Species From Species:
Setosa Versicolor Virginica
Setosa 0 89.86419 179.38471
Versicolor 89.86419 0 17.20107
Virginica 179.38471 17.20107 0
These distances were obtained with proc 'CANDISC'
2014 Jul 04
1
DESCRIPTION.in file causes R CMD check to fail?
hi. i'm building a package using autotools. to propagate the package
version number from configure.ac to DESCRIPTION, i'm using a
DESCRIPTION.in file. both of these files are "shar"'d below.
i need to distribute the DESCRIPTION.in file, as ./configure will need
it. but, "R CMD check" wants to look at DESCRIPTION, so i've let that
also come into the package
2020 Mar 16
1
pipe(): input to, and output from, a single process
Gabor, thanks. yes, managing the two-way communication is always a bit
error-prone, as it depends on the input/output characteristics of the
two ends -- they either match, or deadlock. it's too bad if polling is
always *required* -- i'd think sometimes a programmer would be happy
blocking, though other times one wants better control over when to
block. cheers, Greg
2003 Apr 24
2
R-1.7.0 build feedback: NetBSD 1.6 (PR#2837)
R-1.7.0 built on NetBSD 1.6, but the validation test suite failed:
Machinetype: Intel Pentium III (600 MHz); NetBSD 1.6 (GENERIC)
Remote gcc version: gcc (GCC) 3.2.2
Remote g++ version: g++ (GCC) 3.2.2
Configure environment: CC=gcc CXX=g++ LDFLAGS=-Wl,-rpath,/usr/local/lib
make[5]: Entering directory `/local/build/R-1.7.0/src/library'
>>> Building/Updating
2010 Sep 23
1
Newey West and Singular Matrix + library(sandwich)
thank you, achim. I will try chol2inv.
sandwich is a very nice package, but let me make some short
suggestions. I am not a good econometrician, so I do not know what
prewhitening is, and the vignette did not explain it. "?coeftest" did
not work after I loaded the library. automatic bandwidth selection
can be a good thing, but is not always.
as to my own little function, I like the
2019 Mar 05
2
stopifnot
Another possible shortcut definition:
assert <- function(exprs)
do.call("stopifnot", list(exprs = substitute(exprs), local = parent.frame()))
After thinking again, I propose to use
??? ? ? stop(simpleError(msg, call = if(p <- sys.parent()) sys.call(p)))
- It seems that the call is the call of the frame where stopifnot(...) is evaluated. Because that is the correct context, I
2009 Sep 06
2
question about ... passed to two different functions
I have hit a problem with the design of the mcmc package I can't
figure out, possibly because I don't really understand the R function
call mechanism. The function metrop in the mcmc package has a ... argument
that it passes to one or two user-supplied functions, which are other
arguments to metrop. When the two functions don't have the same arguments,
this doesn't work.
2014 Jul 01
1
creating a package from a development source tree
hi. this is sort of a software methodology question.
i'm working on developing a package (with C source code). developing
it, i use autotools, git, make, and such like. as a result, there are
random files in my source code directory that "R CMD check" would rather
not see. some of these files (such as .git and friends) i could arrange
to move to "just above" my
2014 Jul 13
2
how to list external dependencies (i.e., non-R packages)?
hi. i'm working on a package which only works if one (or both) of two
libraries (Imlib2 and MagickWand) exist on the machine on which the
package is compiled and executed. as currently written, the program
purposely generates an error at *compile* time if neither library is
available (thinking the earlier the user is notified, the less
frustrating).
is there a way of specifying this
2019 Mar 02
1
stopifnot
A private reply by Martin made me realize that I was wrong about
stopifnot(exprs=TRUE) .
It actually works fine. I apologize. What I tried and was failed was
stopifnot(exprs=T) .
Error in exprs[[1]] : object of type 'symbol' is not subsettable
The shortcut
assert <- function(exprs) stopifnot(exprs = exprs)
mentioned in "Warning" section of the documentation similarly fails
2018 Jun 01
1
Understanding the sequence of events when calling the R dpois function
Chuck and Greg,
Thanks a lot for your help! I have a much better understanding now of what is happening ?under the hood?.
Kind Regards,
Jason
> On 31 May 2018, at 20:08, Greg Minshall <minshall at acm.org> wrote:
>
> Jason,
>
> as Chuck Berry (to whom, *thanks* for 'do {...} while(0)'!) suggested,
> using grep, or even grep executed from find, such as
>
2008 Nov 23
2
Latin Hypercube with condition sum = 1
Hi
I want to du a sensitivity analysis using Latin Hypercubes. But my
parameters have to fulfill two conditions:
1) ranging from 0 to 1
2) have to sum up to 1
So far I am using the lhs package and am doing the following:
library(lhs)
ws <- improvedLHS(1000, 7)
wsSums <- rowSums(ws)
wss <- ws / wsSums
but I think I can't do that, as after the normalization
> min(wss)
[1]
2011 Oct 20
4
Randomized Points in space/ saving model results
A bit new to R and I'm working on something a bit more challenging than I am
used to- so here's whats going on:
Data inputs: 9 different shapefiles (.shp) of different point locations
(lat, long)
shapefile bounding box (lat/long corner points (14, 1)
(15,1) (14, 2) (15,2))
1 .csv of lat/long coordinates for points
Goal: a-