similar to: weird behavior with the 3rd root....

Displaying 20 results from an estimated 1000 matches similar to: "weird behavior with the 3rd root...."

2007 Aug 21
4
how do i use the get function to obtain an element from a list...
my problem can be explained with the following example: x <- 1:12 y <- 13:24 a <- data.frame(x = x, y = y) ## if i write a$x ## it returns [1] 1 2 3 4 5 6 7 8 9 10 11 12 ## but the function get doesn't recognize a$x. Instead it produces the following error: get("a$x") Error in get(x, envir, mode, inherits) : variable "a$x" was not found i intend to do
2008 Aug 19
1
address (nil), cause 'memory not mapped'
Dear users, I got this problem and i don't have a clue of what it could be happening... The context: i'm running a loop in which i extract information from a raster map (I work with GRASS and R, using spgrass6 package), and rearrange it to create a matrix. I've tried it with small maps and it works smoothly, but in large maps I have to resort to saving data in the hard disk regularly
2010 Oct 26
5
cube root of a negative number
Hi, This might be me missing something painfully obvious but why does the cube root of the following produce an NaN? > (-4)^(1/3) [1] NaN > As we can see: > (-1.587401)^3 [1] -4 Thanks! Greg
2008 Aug 18
1
problem with save function
Hello list! i write because i'm having a strange problem with the "save" function, here an example: > x <- stats::runif(20) > y <- list(a = 1, b = TRUE, c = "oops") > save(x, y, file = "xy.Rdata") > xy <- load("xy.Rdata") > xy [1] "x" "y" why does this happens, when: > x [1] 0.96586833 0.60340508
2015 Oct 22
0
alternative read.arff function for the package foreign
?Hello everyone, I guess this is really directed to the R Core Team, but I understand that this is the best channel to submit this (please correct me if I'm wrong!). I would like to submit a function to consideration, as an upgrade for the current read.arff in package foreign. Code in github: https://raw.githubusercontent.com/jumanbar/misc/master/R/read.arff.R This function is a modified
2005 Jul 12
5
R: to the power
hi all why does R do this: (-8)^(1/3)=NaN the answer should be : -2 a silly question but i kept on getting errors in some of my code due to this problem. i solve the problem as follows: say we want : (-a)^(1/3) then : sign(a)*(a^(1/3)) works but there has to be a simpler way of soing such a simple mathematical operation. thanking you / allan
2011 Apr 17
5
cube root
This is some interesting: > -8^(1/3) [1] -2 > x=(-8:8) > y=x^(1/3) > y [1] NaN NaN NaN NaN NaN NaN NaN NaN 0.000000 1.000000 [11] 1.259921 1.442250 1.587401 1.709976 1.817121 1.912931 2.000000 So, can anybody explain this?! (Why is x[1]^(1/3)=y[1]=NaN, but -8^(1/3)=-2?) Thx!!! [[alternative HTML version deleted]]
2008 Sep 23
4
How to draw the graph of f(x,y) = x * y ?
Dear All, The function curve() draws the graph of functions from R to R. Is there some homologous function to curve() to draw functions from R^2 to R? Thanks in advance, Paul
2008 Sep 26
1
Generating a valid covariance matrix
I want to generate a valid variance-covariance matrix. One way could be to generate some random sample from multivariate normal distribution and then calculate cov. matrix. Another way could be to sample from wishart distribution itself. However both cases need a valid i.e. PD covariance matrix. As I need to generate that covariance matrix only, I am not interested those two methods. Can anyone
2008 Sep 23
1
Generalising to n-dimensions
Hi R-helpers, I have two queries relating to generalising to n dimensions: What I want to do in the first one is generalise the following statement: expand<-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of integers and expand.grid gives every combination of the set of numbers, so for example, expand.grid(1:2, 1:3) takes 1,2 and 1,2,3 and gives 1,1 2,1 1,2 2,2 1,3 2,3 My x
2018 Jul 10
1
problem with display of complex number
Hi, > 1e10+5i [1] 1e+10+0e+00i > Im(1e10+5i) [1] 5 maybe little better... --- R-3.5.1.orig/src/main/complex.c 2018-03-26 07:02:25.000000000 +0900 +++ R-3.5.1/src/main/complex.c 2018-07-10 12:50:42.523874767 +0900 @@ -381,6 +381,7 @@ r->i = fround(pow10 * x->i, digits)/pow10; } else { digits = (double)(dig); + if(digits < 1) digits=1; /* a little better */
2004 Apr 27
4
Problems raised to 1/3 power and NaN
I am debugging some code and found a function that returns and error most of the time. I have issolated the problem to when it raises an argument to the 1/3 power but for the life of me I can not figure out why it is not working. i have gone through the FAQs and have found nothing (not to say I might have missed something). I am highly embarrased with my inability find the problem (my face is
2009 Jul 18
7
(-8)^(1/3) == NaN?
Why does the expression "(-8)^(1/3)" return NaN, instead of -2? This is not answered by http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-powers-of-negative-numbers-wrong_003f Thanks, Dave [[alternative HTML version deleted]]
2008 Sep 19
6
how to keep up with R?
Dear Listers, I've been a big fan of R since graduate school. After working in the industry for years, I haven't had many opportunities to use R and am mainly using SAS. However, I am still forcing myself really hard to stay close to R by reading R-help and books and writing R code by myself for fun. But by and by, I start realizing I have hard time to keep up with R and am afraid that I
2005 Feb 16
3
real and complex vectors
The following caught me off-guard: R> z <- 1i + 1:10 R> z <- Re(z) R> z [1] 1 2 3 4 5 6 7 8 9 10 as expected. But look: R> z <- 1i + 1:10 R> make.real <- abs(z) < 1000 R> z[make.real] <- Re(z[make.real]) R> z [1] 1+0i 2+0i 3+0i 4+0i 5+0i 6+0i 7+0i 8+0i 9+0i 10+0i R> didn't make z a real vector, which is what I wanted.
2006 May 26
1
Building V2.3.0 on Tru64 V5.1B
Hi, I am going to be attempting a build of R for the alphas (our main need is to collate and present graphically, performance metrics we gather on our applications). We have: CC=cc, CXX=cxx, Fortran V5.51 (f77, f95), GNU make 3.80, Perl 5.8.4 I am hesitant to rebuild GCC on this platform, and would like to know if others have success in building R with native C, C++ and Fortran. I plan on
2008 Jun 03
3
matlab eigs function in R
Hello Does anybody know how one can compute d largest eigenvalues/eigenvectors in R, like in MATLAB eigs function ? eigen function computes all eigenvectors/eigenvalues, and they are slightly different than those generated by matlab eigs. Thanks in advance -- View this message in context: http://www.nabble.com/matlab-eigs-function-in-R-tp17619641p17619641.html Sent from the R help mailing list
2009 Nov 23
1
R: Re: chol( neg.def.matrix ) WAS: Re: Choleski and Choleski with pivoting of matrix fails
It works! But Once I have the square root of this matrix, how do I convert it to a real (not imaginary) matrix which has the same property? Is that possible? Best, Simon >----Messaggio originale---- >Da: p.dalgaard at biostat.ku.dk >Data: 21-nov-2009 18.56 >A: "Charles C. Berry"<cberry at tajo.ucsd.edu> >Cc: "simona.racioppi at
2017 Mar 17
4
Hyperbolic tangent different results on Windows and Mac
Dear all, We seem to have found a "strange" behaviour in the hyperbolic tangent function tanh on Windows. When running tanh(356 + 0i) the Windows result is NaN + 0.i while on Mac the result is 1 + 0i. It doesn't seem to be a floating point error because on Mac it is possible to run arbitrarily large numbers (say tanh(
2001 Jan 17
2
PR#751
I'd just like to report a possible R bug--or rather, confirm an existing one (bug #751). I have had some difficulty using the polyroot() function. For example, in Win 98, R 1.1.1, > polyroot(c(2,1,1)) correctly (per the help index) gives the roots of 1 + (1*x) + (2*x^2) as [1] -0.5+1.322876i -0.5-1.322876i However, > polyroot(c(-100,0,1)) gives the roots of [1] 10+0i -10+0i