[R] Limit on vector evaluation
Dear R Experts, Why I try to run this expression: x-sapply(rnorm(rep(10,10),mean=9,sd=1.5),mean) it evaluates the first 1 values and then stops, but does not return to the command prompt. My cpu keeps running at 100%. When I exit the expression with CTL-C, I then see that x holds 1 values. How can I evalute the expression 10 times, or more if I want? Thanks in advance. __ R-help@stat.math.ethz.ch 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.
[R] Question about converting from square roots to decimals and back
Hi, I apologize if there is a simple answer to this question that I've missed. I did search the mailing list but I might not have used the right keywords. Why does sum(A3^2) give the result of 1, but sum(A3^2)==1 give the result of FALSE? A3-matrix(nrow=3,c(1/(2^.5),1/(2^.5),0)) A3 [,1] [1,] 0.7071068 [2,] 0.7071068 [3,] 0.000 sum(A3^2) [1] 1 sum(A3^2)^.5 [1] 1 sum(A3^2)==1 # here's the part I don't understand [1] FALSE sum(A3^2)^.5==1 # here's the part I don't understand [1] FALSE I realize that it has something to do with the conversion of the square roots into decimals. But shouldn't it then give me some number other than 1 as the result for sum(A3^2)? Are there other ways to do this than what I've tried? I'm trying to confirm that A3 is a unit vector. Thank you for your help. Bob B. __ R-help@stat.math.ethz.ch 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.
[R] Question about converting from square roots to decimals and back
Thank you very much. That was what I needed to know. Bob B. __ R-help@stat.math.ethz.ch 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.