Jim Bouldin
2009-Jul-23 15:30 UTC
[R] error message: .Random.seed is not an integer vector but of type 'list'
I'm trying to run this simple random sample procedure and keep getting the error message shown. I don't understand this; I've designated x as a numeric vector, so what is going on here? Thanks.> x = as.vector(c(1:12));x[1] 1 2 3 4 5 6 7 8 9 10 11 12> mode(x)[1] "numeric"> sample(x, 3)Error in sample(x, 3) : .Random.seed is not an integer vector but of type 'list'>Jim Bouldin, PhD Research Ecologist Department of Plant Sciences, UC Davis Davis CA, 95616 530-554-1740
Uwe Ligges
2009-Jul-23 15:37 UTC
[R] error message: .Random.seed is not an integer vector but of type 'list'
Jim Bouldin wrote:> I'm trying to run this simple random sample procedure and keep getting the > error message shown. I don't understand this; I've designated x as a > numeric vector, so what is going on here? Thanks. > >> x = as.vector(c(1:12));x > [1] 1 2 3 4 5 6 7 8 9 10 11 12 >> mode(x) > [1] "numeric" >> sample(x, 3) > Error in sample(x, 3) : > .Random.seed is not an integer vector but of type 'list'Something has changed/corrupted an object called .Random.seed that is required by the Random Number Generator. Just say rm(.Random.seed) and try again. Uwe Ligges> Jim Bouldin, PhD > Research Ecologist > Department of Plant Sciences, UC Davis > Davis CA, 95616 > 530-554-1740 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Jim Bouldin
2009-Jul-23 15:49 UTC
[R] error message: .Random.seed is not an integer vector but of type 'list'
Thank you. However, when I tried that, I got this message: Warning message: In rm(.Random.seed) : variable ".Random.seed" was not found> > Jim Bouldin wrote: > > I'm trying to run this simple random sample procedure and keep getting > the > > error message shown. I don't understand this; I've designated x as a > > numeric vector, so what is going on here? Thanks. > > > >> x = as.vector(c(1:12));x > > [1] 1 2 3 4 5 6 7 8 9 10 11 12 > >> mode(x) > > [1] "numeric" > >> sample(x, 3) > > Error in sample(x, 3) : > > .Random.seed is not an integer vector but of type 'list' > > > Something has changed/corrupted an object called .Random.seed that is > required by the Random Number Generator. > > Just say > rm(.Random.seed) > and try again. > > Uwe Ligges > > > > > Jim Bouldin, PhD > > Research Ecologist > > Department of Plant Sciences, UC Davis > > Davis CA, 95616 > > 530-554-1740 > > > > ______________________________________________ > > R-help at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. >
Jim Bouldin
2009-Jul-23 16:08 UTC
[R] error message: .Random.seed is not an integer vector but of type 'list'
> > > Jim Bouldin wrote: > > Thank you. However, when I tried that, I got this message: > > > > Warning message: > > In rm(.Random.seed) : variable ".Random.seed" was not found > > > In that case, have you attached some package that has its own > .Random.seed? > Try to find where the current .random.seed comes from R complains about. > > Uwe LiggesNo, there are no attached packages, just the ones that load automatically. The R commander has some type of RNG but it is not loaded. Completely stumped.
(Ted Harding)
2009-Jul-23 16:13 UTC
[R] error message: .Random.seed is not an integer vector but
On 23-Jul-09 15:30:05, Jim Bouldin wrote:> I'm trying to run this simple random sample procedure and keep > getting the error message shown. I don't understand this; I've > Thanks. > >> x = as.vector(c(1:12));x > [1] 1 2 3 4 5 6 7 8 9 10 11 12 >> mode(x) > [1] "numeric" >> sample(x, 3) > Error in sample(x, 3) : > .Random.seed is not an integer vector but of type 'list' > > Jim Bouldin, PhDI think this error is not arising from the code you have given above. I get: x=as.vector(c(1:12)) sample(x,3) # [1] 8 12 2 which is fine. '.Random.seed' should be an integer vector to start with. See '?set.seed'. Therefore it should not be a list. Try entering .Random.seed and see what you get -- when I do it it is a vector of 626 assorted integers. Also try: is.vector(.Random.seed) and, if that is not TRUE, try str(.Random.seed) typeof(.Random.seed) If .Random.seed turns out to be a list, then something has gone seriously wrong somewhere. It may be that somwehere in your code there is a command that meddles with .Random.seed (or perhaps it was saved, in .Rdata, from a previous session where something went wrong). Or, worst scenario, your R installation is broken ... And, while I'm at it, your "x=as.vector(c(1:12))" is overkill! Simply x <- (1:12) ; sample(x,3) should be enough, or even sample((1:12),3) since (1:12) is a vector (of integers). Hoping this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 23-Jul-09 Time: 17:13:55 ------------------------------ XFMail ------------------------------
(Ted Harding)
2009-Jul-23 16:23 UTC
[R] error message: .Random.seed is not an integer vector but
On 23-Jul-09 16:08:17, Jim Bouldin wrote:>> Jim Bouldin wrote: >> > Thank you. However, when I tried that, I got this message: >> >> > Warning message: >> > In rm(.Random.seed) : variable ".Random.seed" was not found >> >> In that case, have you attached some package that has its own >> .Random.seed? >> Try to find where the current .random.seed comes from R complains >> about. >> >> Uwe Ligges > > No, there are no attached packages, just the ones that load > automatically. The R commander has some type of RNG but it is notloaded. Completely stumped. Follow-up to my previous reply (just posted). Having read the other responses and your reactions, try the following: rm(.Random.seed) set.seed(54321) ## (Or your favourite magic number) [*] x = as.vector(c(1:12)) ## To reproduce your original code ... ! sample(x,3) [*] When you did rm(.Random.seed) as suggested by Uwe, the variable .Random.seed was lost, so you have to create it again. If, after the above, you still get the problem, then something is very seriously wrong. Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 23-Jul-09 Time: 17:23:09 ------------------------------ XFMail ------------------------------