[R] how to remove the 'promise' attribute of an R object (.Random.seed)?

Yihui Xie xie at yihui.name
Tue May 22 18:22:28 CEST 2012


Hi,

The problem arises when I lazyLoad() the .Random.seed from a
previously saved database. To simplify the process of reproducing the
problem, see the example below:

## this assignment may not really make sense, but illustrates the problem
delayedAssign('.Random.seed', 1L)

typeof(.Random.seed)
# [1] "integer"

rnorm(1)
# Error in rnorm(1) :
#  .Random.seed is not an integer vector but of type 'promise'

typeof(.Random.seed)
# [1] "integer"

So there must be an "attribute" "promise" somewhere attached to
.Random.seed, and I cannot find it. The R function typeof() does not
reveal it, but the TYPEOF() function in src/main/RNG.c says it is a
'promise'.

My question is, how to make R use the real value of .Random.seed
instead of complaining about the promise? Thanks!

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



More information about the R-help mailing list