search for: 1e7

Displaying 20 results from an estimated 93 matches for "1e7".

Did you mean: 17
2008 Aug 17
1
Wichmann-Hill Random Number Generator and the Birthday Problem
...r, M=2^32. D = 11641.53 for N = 10M samples. My testing results (see below) agree with above analysis. But for Wichmann-Hill, it wasn't. Wichmann-Hill's cycle is 6.9536e12 (refer to RNG help by ?RNG and Whichmann's correction in 1984). Thus M <= 6.9536e12. D >= 7.19052 when N=1e7 and D>= 179.763 for N=5e7. But in my tests, duplications were surprisingly not observed. It seems that Wichmann-Hill has a much larger cycle than the one documented! Anybody can solve this puzzle? Regards, Shengqiao Li Department of Statistics West Virgina Unversity ==============Testing...
2008 Jan 28
1
Integer vs numeric
Hi the list. I do not understand the philosophy behind numeric and integer. - 1 is numeric (which I find surprising) - 2 is numeric. - 1:2 is integer. Why is that ? Christophe
2008 Aug 14
2
[R] RNG Cycle and Duplication (PR#12540)
...nt-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE I didn't describe the problem clearly. It's about the number of distinct=20 values. So just ignore cycle issue. My tests were: RNGkind(kind=3D"Knuth-TAOCP"); sum(duplicated(runif(1e7))); #return 46552 RNGkind(kind=3D"Knuth-TAOCP-2002"); sum(duplicated(runif(1e7))); #return 46415 #These collision frequency suggested there were 2^30 distinct values by=20 birthday problem. RNGkind(kind=3D"Marsaglia-Multicarry"); sum(duplicated(runif(1e7))); #return 11682 R...
2012 May 06
2
unlist crashes 32-bit R on WinXP when use.names=TRUE
...indows XP (sessionInfo below) when running the piece of code below. I cannot replicate the error on 64-bit Linux, 64-bit Windows, or 32-bit R running under 64-bit Windows. I do not have, and could not find, a 32-bit version of Linux to test this. > NOW <- Sys.time() > FUTURE <- NOW+1:1e7 > crash <- as.character(FUTURE) Error in unlist(unclass(x)[1L:3L]) : promise already under evaluation: recursive default argument reference or earlier problems? > traceback() Error: C stack usage is too close to the limit > # evaluating an expression at this point would cause R to exi...
2010 Mar 25
2
print(big+small*1i) -> big + 0i
Should both parts of a complex number be printed to the same precision? The imaginary part of 0 looks a bit odd when log10(real/imag) >=~ getOption("digits"), but I'm not sure it is awful. Some people might expect the same number of significant digits in the two parts. > 1e7+4i [1] 10000000+0i > 1e7+5i [1] 10000000+0i > 1e10 + 1000i [1] 1e+10+0e+00i > getOption("digits") [1] 7 > options(digits=4) > 1e4+4i [1] 10000+0i > 1e7+1000i [1] 10000000+0i > version _ platform i386-pc-mingw32 arch i386 os...
2009 May 10
2
In C, a fast way to slice a vector?
Hello, Suppose in the following code, PROTECT(sr = R_tryEval( .... )) sr is a RAWSXP vector. I wish to return another RAWSXP starting at position 13 onwards (base=0). I could create another RAWSXP of the correct length and then memcpy the required bytes and length to this new one. However is there a more efficient method? Regards Saptarshi Guha
2017 Oct 27
1
Slow down using the compiler
Dear All, In R 3.4.2 (Linux), the compiler seems to have regressed: $ R --vanilla g = function() { N = 1e7; ans = numeric(N) system.time({for (j in 1:N) ans[j] = 1}) } g() # user system elapsed # 4.272 0.000 4.272 g1 = compiler::cmpfun(g) g1() # user system elapsed # 4.232 0.004 4.235 Running the above code in Windows 3.3.1, g() takes the same time, but g1() takes around 0.5 seconds....
2010 Feb 02
1
[R] Suppressing scientific notation on plot axis tick labels (PR#14202)
On 02/02/2010 6:20 AM, Dimitri Shvorob wrote: > Ruben Roa has kindly suggested using 'scipen' option - cf. > >> fixed notation will be preferred unless it is more than ???scipen??? digits >> wider. > > However, > > options(scipen = 50) > x = c(1e7, 2e7) > barplot(x) > > still does not produce the desired result. This is strange. I see what you describe the first time through, but if I print the option I get the non-scientific labels on the second plot: options(scipen = 50) x = c(1e7, 2e7) barplot(x) options("scipen")...
2007 Mar 28
2
Suggestion for memory optimization and as.double() with friends
Hi, when doing as.double() on an object that is already a double, the object seems to be copied internally, doubling the memory requirement. See example below. Same for as.character() etc. Is this intended? Example: % R --vanilla > x <- double(1e7) > gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 234019 6.3 467875 12.5 350000 9.4 Vcells 10103774 77.1 11476770 87.6 10104223 77.1 > x <- as.double(x) > gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 234113 6.3 467875 12.5 350000...
2009 Mar 30
1
List assignment in a while loop and timing
Hello R users I have question about the time involved in list assignment. Consider the following code snippet(see below). The first line creates a reader object, which is the interface to 1MM key-value pairs (serialized R objects) spanning 50 files (a total of 50MB). rhsqstart initiates the reading and I loop, reading each key-value pair using rhsqnextKVR. If this returns NULL, we switch to the
2009 Dec 28
2
seq.int broken (seq as well) (PR#14169)
Full_Name: Jens Oehlschl?gel Version: 2.10.1 OS: Windows XP Submission from: (NULL) (156.109.18.2) # fine as expected from help page: # "from+by, ..., up to the sequence value less than or equal to to" # thus 1+10=11 is not in > seq.int(1L, 10L, by=10L) [1] 1 # of course 1+1e7 should also not be in # but is: wrong > seq.int(1L, 1e7L, by=1e7L) [1] 1e+00 1e+07 # since we use seq.int AND are within integer range, rounding should not be an issue > version _ platform i386-pc-mingw32 arch i386...
2012 Feb 02
1
pgfSweave doesn't lazyload my objects
...erlooking something obvious. Below is my .Rnw and sessionInfo. Pointers, suggestions, etc are most welcome. %%%%%%%%%%%%%%% RNW; test_png.Rnw %%%%%%%%%%%%%%%%%%%%%% \documentclass{article} \begin{document} some bla bla text <<large-chunk-no-cache, cache=false>>= mm1 <- matrix(1:1e7, 1e3, 1e4) @ <<c2>>= print(length(mm1)) @ <<large-chunk-do-cache, cache=true>>= mm2 <- matrix(1:1e7, 1e3, 1e4) @ <<c4>>= print(length(mm2)) @ \end{document} %%%%%%%%%%%%%%%%% END RNW %%%%%%%%%%%%%%%%%% I am running the folowing R command: pgfSweave('...
2016 Dec 20
2
colnames for data.frame could be greatly improved
...hen do.NULL true. This makes huge difference when do.NULL false. Minimal edit to `colnames`: if (is.data.frame(x)) { nm <- names(x) if (do.NULL || !is.null(nm)) return(nm) else return(paste0(prefix, seq_along(x))) } Script and timings: N=1e7; K=100 set.seed(1) DF <- data.frame( id1 = sample(sprintf("id%03d",1:K), N, TRUE), # large groups (char) id2 = sample(sprintf("id%03d",1:K), N, TRUE), # large groups (char) id3 = sample(sprintf("id%010d",1:(N/K)), N, TRUE), # small groups (char...
2010 Feb 02
2
Suppressing scientific notation on plot axis tick labels
Is there a better alternative to x = c(1e7, 2e7) x.lb = c(0,1e7,2e7) s.lb = format(x.lb, scientific = FALSE, big.mark = ",") barplot(x, yaxt = "n", ylab = "") axis(side = 2, at = x.lb, labels = s.lb) (I am sure there is a better alternative to line 2 :)). Thank you. -- View this message in context: http:/...
2010 Feb 02
0
[R] Suppressing scientific notation on plot axis tick labels (PR#14203)
...Roa has kindly suggested using 'scipen' option - cf. >> >>> fixed notation will be preferred unless it is more than =C3=A2=E2=82=AC= =CB=9Cscipen=C3=A2=E2=82=AC=E2=84=A2 digits >>> wider. >> However,=20 >> >> options(scipen =3D 50) >> x =3D c(1e7, 2e7) >> barplot(x)=20 >> >> still does not produce the desired result. >=20 > This is strange. I see what you describe the first time through, but > if I print the option I get the non-scientific labels on the second plo= t: >=20 > options(scipen =3D 50) > x =...
2015 Sep 09
0
sample.int() algorithms
...few seconds. Looking into it, I saw that sample.int() is hardcoded to switch algorithms when the population is larger than 1e+7, and I was straddling this boundary: sample.int <- function(n, size = n, replace = FALSE, prob = NULL) { if (!replace && is.null(prob) && n > 1e7 && size <= n/2) .Internal(sample2(n, size)) else .Internal(sample(n, size, replace, prob)) } do_sample2() takes the approach of taking a sample, and then checking if this sample is a duplicate. As long as the population size is much larger than numbers of samples, this will...
2007 Nov 08
3
skip non-sequential lines using scan?
Hi all, Is there a way to skip non-sequential lines using the "skip" argument in the scan function? E.g., I have a matrix with 100 rows and 1e7 columns. I open a connection and want to read only lines 5, 7, 9, etc [i.e., seq(5,99,2)] It might seem that the syntax to do this would be something like this (if only the "skip" allowed vectors in the same way colClasses does in read.table): con <- file("bigfile",open=&qu...
2012 Dec 13
4
Running MCMC in R
Dear all I am now running a MCMC iteration in the R program. But it is always stucked in some loop. This cause big problems for my research. So I want to know whether we can skip the current dataset and move to next simulated data when the iteration is stucked? Alternatively, can the MCMC chain skip the current iteration when it is stucked and automatically to start another chain with different
2024 Mar 08
1
Function environments serialize to a lot of data until they don't
Hello R-help, I've noticed that my 'parallel' jobs take too much memory to store and transfer to the cluster workers. I've managed to trace it to the following: # `payload` is being written to the cluster worker. # The function FUN had been created as a closure inside my package: payload$data$args$FUN # function (l, ...) # withCallingHandlers(fun(l$x, ...), error =
2018 Sep 14
2
Bug when calling system/system2 (and request for Bugzilla account)
I hope it's not too specific in my setup... I've tried with system2 added on the first line, so: Example.R: system2('ls', timeout=5) cat('Start non-interruptable functions\n') sample_a <- sample(1:1e7) sample_b <- sample(1:2e7) matching <- match(sample_a, sample_b) cat('Finished\n') Sys.sleep(10) And in terminal/bash: R --vanilla source('Example.R') Send ^C between the messages (Start... until Finished) Or if you have a more powerful CPU you can increase the samples, the...