Alessandro
2009-Apr-27 18:29 UTC
[R] problem with Power function on a power my result is "inf"
Dear user, I have a problem with a power because after a value the result is "inf" Mydata <- data.frame(plot=c(11,12,13,14,15, 16, 21, 22, 23, 24, 25, 26, 31, 32,33, 34), SumH=c(17573.029,22572.162,19659.984,13952.781,6996.924,16049.598,13869.409, 8284.981,7752.961,18901.742,11078.659,33692.330,44456.277,18737.265,21623.89 8,15837.077)) # USE a power from 1 to 10 by 0.1 power <- seq(1.0, 10.0, by=0.1) for (method in 1:length(power)){ Mydata$power <- paste(Mydata$SumH^method) write.matrix(Mydata, paste(file "C:/SNAMP_fns/GSmodel/mydata","_",method+9,".txt", sep=""), sep = "\t") } On 57 power some value strart to be "inf". All "inf" in power of 10. Is It a limit of memory or another problem? Eventually is there a possibility to correct? Or I need to use a seq from 1 to 5 or less? Thanks Ale [[alternative HTML version deleted]]
Uwe Ligges
2009-Apr-28 12:56 UTC
[R] problem with Power function on a power my result is "inf"
Alessandro wrote:> Dear user, > > > > I have a problem with a power because after a value the result is "inf" > > > > > > Mydata <- data.frame(plot=c(11,12,13,14,15, 16, 21, 22, 23, 24, 25, 26, > 31, 32,33, 34), > > SumH=c(17573.029,22572.162,19659.984,13952.781,6996.924,16049.598,13869.409, > 8284.981,7752.961,18901.742,11078.659,33692.330,44456.277,18737.265,21623.89 > 8,15837.077)) > > > > # USE a power from 1 to 10 by 0.1 > > power <- seq(1.0, 10.0, by=0.1) > > > > for (method in 1:length(power)){ > > > > Mydata$power <- paste(Mydata$SumH^method) > > write.matrix(Mydata, paste(file > "C:/SNAMP_fns/GSmodel/mydata","_",method+9,".txt", sep=""), sep = "\t") > > > > } > > > > On 57 power some value strart to be "inf". All "inf" in power of 10. Is It a > limit of memory or another problem?Do you mean Mydata$SumH^method or Mydata$SumH^(power[method]) ? If the latter, you won't see Inf as early as before. The limit is the representation of floating point numbers. See ?.Machine on how to learn about the limits of your version of R / platform. Uwe Ligges> > > Eventually is there a possibility to correct? Or I need to use a seq from 1 > to 5 or less?>> > > Thanks Ale > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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.