search for: rounding

Displaying 20 results from an estimated 2074 matches for "rounding".

2006 Mar 07
13
Active Record - Can''t figure out relationship.
I have the following two tables: create table teams ( id int not null auto_increment, short_name varchar(12) not null, long_name varchar(50) not null, logo varchar(20) not null, primary key (id) ); create table rounds ( id int not null auto_increment, home_team_id int not null, away_team_id int
2006 Jun 23
6
float calculation error
Hi I have the following values pActualCost = 33.00 pPaymentCost = 29.99 So this calculation should leave me with 0.01 pPaymentDifference = pActualCost - pPaymentCost however when doing this in rails, it returns 0.00999999999999801 has anyone got any suggestions to whats going wrong and how I can correct this Thanks Scott -- Posted via http://www.ruby-forum.com/.
2012 Sep 12
8
Round off method in 1.8.7
Hi all i am trying to use round method if have a value 2.08 i want it as 2.1 and it worked in 1.9.2 but not in 1.8.7 is there any other way of doing it. USING 1.9.2 1.9.2p320 :001 > 2.08.round(1) => 2.1 1.9.2p320 :002 > 2.04.round(1) => 2.0 USING 1.8.7 irb(main):001:0> 2.08.round => 2 irb(main):002:0> 2.08.round(1) ArgumentError: wrong number of arguments (1 for
2011 Dec 01
3
round to specific intervals
Dear R users/helpers, I am wondering is there an existing function in which you can round numbers to a set of values. I know you can use 5 * round(x/5) for rounding to the nearest 5 or so, but what if the interval size is not constant. For example: ## Not run test <- rnorm(100) round(test, c(1, 5, 10, 20, 50)) so that the test is rounded to the closest value in the vector. Thanks for the help. Cheers,
2007 Sep 16
8
Rounding up to two decimal places
Hi there I am going to calculate VAT at one of my websites, and UK VAT is 17.5 %. So the question is how to round up some value to two decimal points? I often get values like 6,991.. In php I was using round function round($price, 2) is in ruby something similat to PHP''s round function where I could specify number of decimal places ? P.
2012 Apr 03
2
"Failed to create rounding.h!" during make
...t;make" the Makefile. Did some STFW''ing and have found several variations of this problem. Other mentions have included redirecting the output of this part of the code to stdout or a file instead of /dev/null but it looks like my Makefile includes this already: it redirects to rounding.out and cats that file after it fails. That is, this section of Makefile: ---------------- flist.o: rounding.h rounding.h: rounding.c rsync.h @for r in 0 1 3; do \ if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >round...
2008 Jul 10
6
rounding
Hi, Round(0.55,1)=0.5 Round(2.55,1)=2.6 Can this be right? Thanks, Ed [[alternative HTML version deleted]] ______________________________________________ R-help@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,
2005 Feb 22
4
round() - strange results
Hello, I found that round() does not behave as I expected. Have you had similar experience as following? > x<-seq(0.5,10.5,by=1) > x [1] 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 > round(x) [1] 0 2 2 4 4 6 6 8 8 10 10 > cbind(x,round(x)) x [1,] 0.5 0 [2,] 1.5 2 [3,] 2.5 2 [4,] 3.5 4 [5,] 4.5 4 [6,] 5.5 6 [7,] 6.5 6
2016 Apr 19
2
Interquartile Range
> That didn't work Jim! It always helps to say how the suggestion did not work. Jim's function had a typo in it - was that the problem? Or did you not change the call to ddply to use that function. Here is something that might "work" for you: library(plyr) data <- data.frame(groupColumn=rep(1:5,1:5), col1=2^(0:14)) myIqr <- function(x) {
2008 Aug 07
4
Obtaining the first /or last record of a subject in a longitudinal study
Dear R users, I was wondering if anyone knows how to obtain(subset) the first and/or the last record of a subject in a longitudinal setup. Normally in SAS one uses first.variable1 and last.variable1. So my question is that is there an R way of doing this. Regards, -- Luwis Diya, Phd student (Biostatistics), Biostatistical Center, School Of Public Health, Catholic University of Leuven,
2011 Aug 21
3
Multiple R linear models into one Latex table
Dear community, I had been looking for an easy way to produce latex tables from R output. xtable() and the package apsrtable produce good outputs but they are not exactly what I was looking for. I wrote this code that generates regression tables from multiple R linear models. I want to share it because it might be useful for someone else, and because I would appreciate comments on how to
2012 Apr 27
2
get plot axis rounding method
Hello, Does anyone know how to get the rounding method used for the axis tick numbers/values in plot()? I''m using mtext() to plot the values used to plot vertical and horizontal lines (using abline()) and I''d like these vertical and horizontal line values to be rounded like the axis tick values are rounded. In other words...
2010 Nov 28
6
unexpected behavior using round to 2 digits on randomly generated numbers
Hello! I stumbled upon something odd that took a while to track down, and I wanted to run it by here to see if I should submit a bug report. For randomly generated numbers (from a variety of distributions) rounding them to specifically 2 digits and then multiplying them by 100 produces strange results on about 8% of cases. The problematic numbers display as I would have expected, but do not logically match the as.integer counterpart (additionally they will not be used correctly by functions such as rep()). I...
2008 Jul 20
0
Off topic: SS formulae for 3-way repeated measure anova (for when aov() fails)
...emp.d) temp$x = rnorm(length(temp[, 1])) #generate some random DV data sub=temp$sub a=temp$a b=temp$b d=temp$d x=temp$x this_aov = aov( x~a*b*d+Error(sub/(a*b*d)) ) summary(this_aov) #now let''s try by hand, checking each sum-of-squares # ss against the analogous aov() produced ss (rounding # each to avoid small computational differences) #Get ss.subs sub.means = aggregate(x,list(sub=sub), mean) grand.mean = mean(sub.means$x) ss.total = sum((x-grand.mean)^2) ss.subs = levs.a*levs.b*levs.d*sum((sub.means$x-grand.mean)^2) round(ss.subs, 10)==round(summary(this_aov)[[1]][[1]]$Sum, 10)...
2016 Apr 19
1
Interquartile Range
To be precise: paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-") is an expression that evaluates to a character string: "round(quantile(x,.25),0) - round(quantile(x,0.75),0)" no matter what the argument of your function, x. Hence return(paste(...)) will return this exact character string and never evaluates x. Cheers, Bert Bert Gunter "The
1998 Oct 15
2
Fwd: probably "round()" bug
...ct I've done: > >> round(0.5) >[1] 0.5 >> round(-1.5) >[1] -1.5 > >In the documentation is writed: > >......... >round' rounds the values in its first argument to the > specified number of decimal places (default 0). Note > that for rounding off a 5, the IEEE standard is used, > ``go to the even digit''. Therefore `round(0.5)' is > `0' and `round(-1.5)' is `-2'. >......... > >any suggestion is appreciated! > >Andrea Rossetti. > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-....
1998 Oct 15
2
Fwd: probably "round()" bug
...ct I've done: > >> round(0.5) >[1] 0.5 >> round(-1.5) >[1] -1.5 > >In the documentation is writed: > >......... >round' rounds the values in its first argument to the > specified number of decimal places (default 0). Note > that for rounding off a 5, the IEEE standard is used, > ``go to the even digit''. Therefore `round(0.5)' is > `0' and `round(-1.5)' is `-2'. >......... > >any suggestion is appreciated! > >Andrea Rossetti. > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-....
2016 Apr 19
1
Interquartile Range
NO NO -- I am wrong! The paste() expression is of course evaluated. It's just that a character string is returned of the form "something - something". I apologize for the confusion. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County"
2016 Apr 19
1
Interquartile Range
HI that did not work for me either. The value I got returned from that function was "<rounded mean> - <rounded mean>" :(. thanks for the reply through On Tue, Apr 19, 2016 at 10:34 AM, William Dunlap <wdunlap at tibco.com> wrote: > > That didn't work Jim! > > It always helps to say how the suggestion did not work. Jim's > function had a typo
2016 Apr 19
1
Interquartile Range
... and I'm getting another cup of coffee... -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Apr 19, 2016 at 10:30 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > NO NO -- I am wrong! The paste() expression is