Displaying 20 results from an estimated 9298 matches for "rounding".
2011 Mar 30
0
Plot an ols() call from Design
Dear users,
I am attempting to plot an ols() call from the Design package, by
following the procedure explained by Harald Baayen in his 2008 book
'Analyzing linguistic data. A practical introduction to statistics
using R', page 175-181.
I've attached my data to this e-mail (I hope it's small enough that that's ok).
First I paste all the commands I ran, followed by the
2009 May 20
2
round function seems to produce maximum 2 decimals
I am trying to use round()to force R to display a specific number of
decimals, but it seems to display <=2 decimals no matter what I specify in
the digits argument. As an alternative I tried signif(), but it also
produces unexpected results. See example code and results below. Format()
works, but then the result no longer is numeric. Am I missing something
simple?
I am using R 2.9.0 on Windows
2013 Jan 03
3
Question on Round function
I happened to see these:
> round(.5, 0)
[1] 0
> round(1.5, 0)
[1] 2
> round(2.5, 0)
[1] 2
> round(3.5, 0)
[1] 4
> round(4.5, 0)
[1] 4
What is the rule here?
Should not round(.5, 0) = 1, round(2.5, 0) = 3 etc?
Thanks and regards,
2007 Jul 06
0
Branch 'as' - 2 commits - libswfdec/swfdec_as_math.c test/trace
...00..7d23dfb
Binary files /dev/null and b/test/trace/round-direction-5.swf differ
diff --git a/test/trace/round-direction-5.swf.trace b/test/trace/round-direction-5.swf.trace
new file mode 100644
index 0000000..39ef339
--- /dev/null
+++ b/test/trace/round-direction-5.swf.trace
@@ -0,0 +1,5 @@
+Check rounding direction
+0
+-1
+1
+2
diff --git a/test/trace/round-direction-6.swf b/test/trace/round-direction-6.swf
new file mode 100644
index 0000000..75cbbf9
Binary files /dev/null and b/test/trace/round-direction-6.swf differ
diff --git a/test/trace/round-direction-6.swf.trace b/test/trace/round-direction-6...
2024 Feb 08
1
round.Date and trunc.Date not working / implemented
Technically, there is a round() for 'Date' objects, but it doesn't
seem very useful, because it basically just fall back to the default
round() method, which only takes the 'digits' argument.
Here's an example:
> date <- Sys.Date()
> class(date)
[1] "Date"
We see that there are only two round() methods in addition to the
implicit built-in one;
>
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
2008 Jun 15
2
round(1.5) = round(2.5) = 2?
Dear R-users
with a bit of grief I had to repeat an extensive analysis because I
did not suspect (and therefore did not read the documentation) that
round was implemented as "for rounding off a 5, the IEC 60559 standard
is expected to be used, 'go to the even digit'", resulting in
round(1.5) = 2
round (2.5) = 2.
As a non-mathematician I am both puzzled and intrigued by this rule as
it is against what I have learned in my math courses, i.e.
round(1.5) = 2
round (2.5...
2024 Feb 08
1
round.Date and trunc.Date not working / implemented
This is a workaround, and could be the basis for a round.Date improvement:
date <- Sys.Date()
as.Date(round(as.POSIXct(date), "years"))
as.Date(round(as.POSIXct(Sys.Date() + 180), "years"))
Duncan Murdoch
On 08/02/2024 12:23 p.m., Henrik Bengtsson wrote:
> Technically, there is a round() for 'Date' objects, but it doesn't
> seem very useful,
2024 Feb 08
1
round.Date and trunc.Date not working / implemented
?s 14:36 de 08/02/2024, Olivier Benz via R-devel escreveu:
>> On 8 Feb 2024, at 15:15, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>>
>>>>>>> Ji?? Moravec
>>>>>>> on Wed, 7 Feb 2024 10:23:15 +1300 writes:
>>
>>> This is my first time working with dates, so if the answer is "Duh, work
>>> with
2024 Feb 09
1
round.Date and trunc.Date not working / implemented
...ot;years")
??? ? as.Date(round.POSIXt(x, units, ...))
??? else .Date(round(as.numeric(x)))
? }
Or perhaps `unclass` instead of `as.numeric`. Since the default `units`
for round(x) evaluates
to `sec`, this should correctly skip the first condition in `round` and
get to the correct numeric
rounding.
Perhaps the `trunc.Date` should be modified as well so that the call to
`round.Date` is skipped in favour of internal `round.numeric`, saving
few cycles.
-- Jirka
2020 Feb 08
1
round(x, dig) [was "Development version of R fails tests .."]
...which itself triggered an involved dialogue, mostly online,
visible at the PR's URL above.
It lead me to also write an R package 'round' (in order to
compare R 3.6.x and later's round() versions, comparing them etc)
with a (not entirely polished) package vignette
that explains how rounding to decimal digits is not at all
trivial and why and how I ended (*) improving R's
round(x, digits) algorithm in R-devel.
The CRAN version of the package
https://cran.r-project.org/package=round
install.packages("round")
is not quite current, notably its vignette isn'...
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/.
2007 Aug 02
6
- round() strange behaviour
Hi,
I am getting some strange results using round - it seems that it depends if the number before the decimal point is odd or even ....
For example:
> round(1.5)[1] 2> round(2.5)[1] 2
While i would expect that round(2.5) be 3 and not 2.
Do you have any explanation for that?
I really appreciate your input,
Monica
2024 Feb 08
2
round.Date and trunc.Date not working / implemented
> On 8 Feb 2024, at 15:15, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
>>>>>> Ji?? Moravec
>>>>>> on Wed, 7 Feb 2024 10:23:15 +1300 writes:
>
>> This is my first time working with dates, so if the answer is "Duh, work
>> with POSIXt", please ignore it.
>
>> Why is not `round.Date` and
2020 Sep 04
3
Misleading documentation on FP to integer conversion instructions?
> On Sep 4, 2020, at 2:40 PM, Neil Nelson via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
>> If fptosi takes 0.9 -> 0, then that is not 'rounding' in any sense I'm aware of (IEEE754 or otherwise).
>> Rounding (in the IEE754 sense) determines how a number is converted when it is halfway between two
>> candidate results. (see round(), ceil(), floor()).
Rounding in the IEEE 754 sense is simply an algorithm to choose one o...
2005 Oct 24
1
Problems with pf() with certain noncentral values/degrees of freedom combinations
Hello all.
It seems that the pf() function when used with noncentral parameters can
behave badly at times. I've included some examples below, but what is
happening is that with some combinations of df and ncp parameters,
regardless of how large the quantile gets, the same probability value is
returned. Upon first glance noncentral values greater than 200 may seem
large, but they are in
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,
2012 Apr 03
1
"Failed to create rounding.h!" during make
...nable to "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 >rounding....
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 Jul 28
2
Animated gif or something similar in R?
I'm have a (minor) problem and a question.
Problem: The following code creates 5 clusters of dots of different
colors. However, I need the second call outside the data.frame call to
get the colors to change for some reason. I assume there's an error in
the data.frame() call, but I don't know what.
Question: Is there is a way to cause the resulting graphic to rotate on
it's