search for: 1e06

Displaying 9 results from an estimated 9 matches for "1e06".

Did you mean: 1.06
2010 Mar 09
0
Removing Zeros from matrix:Problem fixed
...ndex. I think the >>> following syntax using apply is more easy to understand: >>> >> >> well, this way is much more efficient to compute, especially if you have >> many rows. Compare the following to see the difference: >> >> mat <- matrix(rnorm(2*1e06), 1e06, 2) >> mat[sample(2*1e06, 50)] <- 0 >> >> system.time(index1 <- !apply(mat == 0, MARGIN = 1, any)) >> >> system.time(index2 <- rowMeans(mat == 0) == 0 ) >> >> all.equal(index1, index2) >> > Point taken, I totally agree that for larg...
2010 Nov 11
2
comma separated format
Hi All, I'm trying to create labels to plot such that it doesn't show up as scientific notation. So for example how do I get R to show 1e06 as $1,000,000. I was wondering if there was a single function which allows you to do that, the same way that as.Date() allows you to show in date format on a plot. Thanks, Sachin --- Please consider the environment before printing this email --- Allianz - Best General Insurance Company of the...
2010 Mar 09
3
Removing Zeros from matrix
Hi Everybody, I have a matrix of about 45 columns. Some of the rows contain zeros. Using >data1<-data[complete.cases(data),], I can remove the "NA" rows. But I am unable to tackle that of zeros. Can anybody give me an idea of how to remove rows containing zeros in a matrix. Thanks so much Best Ogbos [[alternative HTML version deleted]]
2008 Jan 31
3
fastest way to compute the squared Euclidean distance between two vectors in R
I have a program which needs to compute squared Euclidean distance between two vectors million of times, which the Rprof shows is the bottleneck. I wondered if there is any faster way than my own simple function distance2 = function(x1, x2) { temp = x1-x2 sum(temp*temp) } I have searched the R-help archives and can not find anything except when the arguments are matrices. Thanks for any
2011 Mar 30
3
optim and optimize are not finding the right parameter
Dear all, I have a function that predicts DV based on one predictor pred: pred<-c(0,3000000,7800000,15600000,23400000,131200000) DV<-c(0,500,1000,1400,1700,1900) ## I define Function 1 that computes the predicted value based on pred values and parameters a and b: calc_DV_pred <- function(a,b) { DV_pred <- rep(0,(length(pred))) for(i in 1:length(DV_pred)){ DV_pred[i] <- a *
2008 Mar 04
3
problem
Good evening to everybody, I have problems to import in R a really big dataset (more than 1000000 values). Which is the best package to install? Is there someone who works with this kind of dataset and can help me, please? Thank you very much, Regards Dr.ssa Erika Frigo Department of Veterinary Sciences and Technology for Food Safety University of Milan Via Grasselli, 7 20137 Milano Tel.
2009 Jul 17
6
Solving two nonlinear equations with two knowns
Dear R users, I have two nonlinear equations, f1(x1,x2)=0 and f2(x1,x2)=0. I try to use optim command by minimize f1^2+f2^2 to find x1 and x2. I found the optimal solution changes when I change initial values. How to solve this? BTW, I also try to use grid searching. But I have no information on ranges of x1 and x2, respectively. Any suggestion to solve this question? Thanks, Kate
2011 Mar 29
5
Integration with variable bounds
If this is posted elsewhere I cannot find it. I need to perform multiple integration where some of the variables are in the bounds of the other variables. I was trying to use R2Cuba function but cannot set the upper and lower bounds. My code so far is : int <- function(y){ u2 = y[1] z2 = y[2] u1 =y[3] z1 = y[4] ff <- u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2)) return(ff) }
2010 Jun 26
4
optim() not finding optimal values
I am trying to use optim() to minimize a sum-of-squared deviations function based upon four parameters. The basic function is defined as ... SPsse <- function(par,B,CPE,SSE.only=TRUE) { n <- length(B) # get number of years of data B0 <- par["B0"] # isolate B0 parameter K <- par["K"]