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

Did you mean:
found

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 not null,
round tinyint(4) not null,
home_team_score tinyint(8) not null,
away_team_score tinyint(8) not null,
constraint fk_home_teams for...

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...

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....

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.
--~--~---------~--~----~------------~-------~--~----~
You...

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 >ro...

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:/...

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
[...

2016 Apr 19

2

Interquartile Range

...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) {
paste(round(quantile(x,0.25),0),round(quantile(x,0.75),0),sep="-")
}
ddply(data, ~groupColumn, summarise, col1_myIqr=myIqr(col1),
col1_IQR=stats::IQR(col1))
# groupColumn col1_myIqr col1_IQR
#1 1 1-1 0
#2 2 2-4 1
#3 3 12-24 1...

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

...Odd rows (coefficients)
cat(dimnames(mat.all)[[1]][i],"&")
cat(
for (j in 1:(length(modelos)-1)) {
if(!is.na(mat.all[i,j])) {
p.val<-abs(mat.all[i,j]/mat.all[i+1,j])
if(p.val>1.644) {
if(1.645<=p.val & p.val<1.96) cat("\\textbf{",round(mat.all[i,j], digits=5),"*}&", sep="") else {
if(1.96<p.val & p.val<2.576) cat("\\textbf{",round(mat.all[i,j], digits=5),"**}&", sep="") else {
cat("\\textbf{",round(mat.all[i,j], digits=5),"***}&&quo...

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 wo...

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())....

2008 Jul 20

0

Off topic: SS formulae for 3-way repeated measure anova (for when aov() fails)

...sis "by hand" so to speak.
However, as demonstrated below, when comparing my attempt to aov()
using a smaller data set, I seem to betray some sort of
misunderstanding when I try to compute SSerr for the first interaction.
Obviously I have missed something and although I have looked around
for the explicit SSerr formulas for this design (my work thus far was
extrapolated from understanding of a 2-way design), I can''t seem to
find any.
Any help would be much obliged.
N = 20
levs.a = 2
levs.b = 2
levs.d = 10
temp.sub = factor(1:N)
temp.a = factor(1:levs.a)
temp.b = fa...

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 stri...

1998 Oct 15

2

Fwd: probably "round()" bug

>Date: Thu, 15 Oct 1998 15:30:22 +0200
>To: Guido Masarotto <guido at sirio.stat.unipd.it>
>From: Andrea Rossetti <rossetti at stud.unipg.it>
>Subject: probably "round()" bug
>
>Hi to all R people,
>I'm using the Guido Masarotto's compiled R, version 0.62.3.
>there is a probably bug in round function, in fact I've done:
>
>> round(0.5)
>[1] 0.5
>> round(-1.5)
>[1] -1.5
>
>In the documentation is writed:
>...

1998 Oct 15

2

Fwd: probably "round()" bug

>Date: Thu, 15 Oct 1998 15:30:22 +0200
>To: Guido Masarotto <guido at sirio.stat.unipd.it>
>From: Andrea Rossetti <rossetti at stud.unipg.it>
>Subject: probably "round()" bug
>
>Hi to all R people,
>I'm using the Guido Masarotto's compiled R, version 0.62.3.
>there is a probably bug in round function, in fact I've done:
>
>> round(0.5)
>[1] 0.5
>> round(-1.5)
>[1] -1.5
>
>In the documentation is writed:
>...

2016 Apr 19

1

Interquartile Range

...uble 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:25 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
> 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...

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

...at 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:25 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
>> 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
>>
>&...