similar to: exactly representable numbers

Displaying 20 results from an estimated 6000 matches similar to: "exactly representable numbers"

2006 Apr 06
3
convert a data frame to matrix - changed column name
I have a question, which very easy to solve, but I can't find a solution. I want to convert a data frame to matrix. Here my toy example: > L3 <- c(1:3) > L10 <- c(1:6) > d <- data.frame(cbind(x=c(10,20), y=L10), fac=sample(L3, + 6, repl=TRUE)) > d x y fac 1 10 1 1 2 20 2 1 3 10 3 1 4 20 4 3 5 10 5 2 6 20 6 2 > is.data.frame(d) [1] TRUE > sapply(d,
2005 Mar 08
2
a==0 vs as.integer(a)==0 vs all.equal(a,0)
hi ?integer says: Note that on almost all implementations of R the range of representable integers is restricted to about +/-2*10^9: 'double's can hold much larger integers exactly. I am getting very confused as to when to use integers and when not to. In my line I need exact comparisons of large integer-valued arrays, so I often use as.integer(), but the above
2006 Aug 22
1
big numbers
Hi Can I get R to handle really big numbers? I am not interested in more than (say) 10 sig figs, but I would like to deal with numbers up to, say, 10^10000. If a <- 10^10000 b <- pi* a I would like "a+b" to return 3.1415926e10000. Toy example, illustrating why I can't deal with log(a) and log(b), follows. f <- function(a,n=100){ out <- rep(0,n)
2005 Jul 11
1
Sweave and complex numbers
Hi When using Sweave, most of my functions get called with complex arguments. They get typeset in with additions that I don't want; "1+1i" appears as "1 + (0 + 1i)" and I would rather have plain old "1+1i". Example follows: \documentclass[a4paper]{article} \title{A Test File} \author{Robin Hankin} \usepackage{a4wide} \begin{document} \maketitle A
2006 Sep 21
1
printing of complex numbers in R-alpha
Hello everyone I am finding complex numbers to be printed oddly in R-alpha. > 1e100+1e100i [1] 1e+100+1e+100i > 1e100 + 1e44i [1] 1e+100+100000000000000008821361405306422640701865984i > dput(1e100+1e44i) 1e+100+100000000000000008821361405306422640701865984i > [same thing at home on a linux box] The first line is what I would expect, the second and third lines aren't: I
2005 Mar 31
1
Contingency table: logistic regression
Hi, I am analyzing a data set with greater than 1000 independent cases (collected in an unrestricted manner), where each case has 3 variables associated with it: one, a factor variable with 0/1 levels (called XX), another factor variable with 8 levels (X) and a third response variable with two levels (Y: 0/1). I am trying to see if X1 has an effect on the relationship between X2 and the
2009 Nov 05
2
[LLVMdev] Strange error for libLLVMCore.a
mingw, llvm 2.6 (buid with llvm-gcc) Example source code: http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html I change LLVMCreateJITCompiler(&engine, provider, &error); to LLVMCreateJITCompiler(&engine, provider, 3, &error); $ llvm-gcc `llvm-config --cflags` -c fac.c $ g++ `llvm-config --libs --cflags --ldflags core analysis executionengine jit
2005 Jan 07
1
Visualizing complex analytic functions using domain coloring
Hi has anyone coded up domain colouring for visualizing complex analytic functions (such as elliptic functions)? [ the idea is to depict a complex function f(z) using a filled.contour() variant in which the hue is given by Arg(f(z)), and the saturation by Mod(f(z)). ] -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre European Way, Southampton SO14 3ZH, UK tel
2006 Jul 19
2
Stirling numbers
Hi anyone coded up Stirling numbers in R? [I need unsigned Stirling numbers of the first kind] cheers Robin -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
2006 Jan 23
1
Sample rows in data frame by subsets
Hi, I need to resample rows in a data frame by subsets L3 <- LETTERS[1:3] d <- data.frame(cbind(x=1, y=1:10), fac=sample(L3, 10, repl=TRUE)) x y fac 1 1 1 A 2 1 2 A 3 1 3 A 4 1 4 A 5 1 5 C 6 1 6 C 7 1 7 B 8 1 8 A 9 1 9 C 10 1 10 A I have seen this used to sample rows with replacement d[sample(nrow(d), replace=T), ] x y fac 7 1 7 B 2
2009 Jun 03
1
Need help understanding output from aov and from anova
Hi all, I noticed something strange when I ran aov and anova. vtot=c(7.29917, 7.29917, 7.29917) #identical values fac=as.factor(c(1,1,2)) #group 1 has first two elements, group 2 has the 3rd element When I run: > anova(lm(vtot~fac)) Analysis of Variance Table Response: vtot Df Sum Sq Mean Sq F value Pr(>F) fac 1 1.6818e-30 1.6818e-30 0.3333 0.6667 Residuals 1
2006 Feb 28
2
lines() and recycled colours
Hi ?lines says For 'type = "h"', 'col' can be a vector and will be recycled as needed. Why doesn't lines() recycle colours for other types? If I type > plot(0:1,0:1,type="n") > lines(runif(11),runif(11),col=c("red","green")) > then all ten lines are red, with no warning given. Is there a reason why
2012 May 29
1
GAM interactions, by example
Dear all, I'm using the mgcv library by Simon Wood to fit gam models with interactions and I have been reading (and running) the "factor 'by' variable example" given on the gam.models help page (see below, output from the two first models b, and b1). The example explains that both b and b1 fits are similar: "note that the preceding fit (here b) is the same as
2013 Dec 14
2
Change factor levels
Suppose I have a dataframe 'd' defined as L3 <- LETTERS[1:3] d0 <- data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace = TRUE)) (d <- d0[d0$fac %in% c('A', 'B'),]) x y fac 2 1 2 B 3 1 3 A 4 1 4 A 5 1 5 A 6 1 6 B 8 1 8 A Even though factor 'fac' in 'd' only has 2 levels, but it seems to bear the birthmark
2006 Jul 26
2
largest acceptable lookup table in a package
Hi One of my packages needs a look-up table of pre-calculated numbers in the data directory. I would like to have the matrix as large as possible. What is the largest size matrix that would be an acceptable datafile in an R package? [ The table is a square, upper triangular matrix consisting of logs of Stirling numbers calculated by Maple. As discussed on the List a few days ago (thanks
2013 Jan 17
3
Colors in interaction plots
Hi, I am trying to plot an interaction.plot with different color for each level of a factor. It has an erratic behavior. For example, it works for the first interaction.plot below, with the example from the ALDA book, but not with the other plots, from the NPK dataset: # from http://www.ats.ucla.edu/stat/r/examples/alda/ch2.htm tolerance <-
2005 Apr 13
2
Inf +1i vs 1+Inf*1i
Hi If I have a <- Inf + 1i then Re(a) is Inf, and Im(a) is 1, as expected. But if b <- 1 + Inf * 1i, then Im(b) = Inf , as expected, but Re(b) = NaN, which I didn't expect. Why this asymmetry? How to define an object with Re(b)=1, Im(b)=Inf? -- Robin Hankin Uncertainty Analyst Southampton Oceanography Centre European Way, Southampton SO14 3ZH, UK tel 023-8059-7743
2005 Sep 21
3
size of subplots with par() / layout()
Hi If I do this: par(mfrow=c(2,2)) persp(matrix(1:4,6,6),box=F,phi=33,theta=33) persp(matrix(1:4,6,6),box=F,phi=33,theta=33) persp(matrix(1:4,6,6),box=F,phi=33,theta=33) persp(matrix(1:4,6,6),box=F,phi=33,theta=33) ( or indeed layout(matrix(1:4,2,2)) persp . . . . ) then the mesh plots look too small to me. How do I make them larger? -- Robin Hankin Uncertainty Analyst National
2006 Feb 22
3
elements that appear only once
Hi. I have a factor and I want to extract just those elements that appear exactly once. How to do this? Toy example follows. > a <- as.factor(c(rep("oak",5) ,rep("ash",1),rep("elm",1),rep ("beech",4))) > a [1] oak oak oak oak oak ash elm beech beech beech beech Levels: ash beech elm oak > table(a) a ash beech elm oak
2006 Jul 25
2
pari/gp interface
Hi I'm developing an R package that needs to execute some code written in pari/gp. I've used this before from an R package (elliptic) but the interface is very basic: the R function creates a string such as the following: string <- echo ' ellwp ([ 2+0*I , 0+2*I ], 1+0*I )' | gp -q And then system(string) returns the output from gp which then needs to be text processed