Displaying 20 results from an estimated 8000 matches similar to: "cube root on array"
2006 Jan 06
7
Multiplication (PR#8466)
hi - in version 2.1 the command
>-2^2
gives
-4
as the answer. (-2)^2 is evaluated correctly.
Cheers,
George Casella
--
George Casella Phone: (352) 392-1941 Ext. 204
Distinguished Professor and Chair Cell: (352) 682-7210
Department of Statistics Fax: (352) 392-5175
University of Florida Email: casella at stat.ufl.edu
P.O. Box 118545
Gainesville, FL
2006 Jan 06
7
Multiplication (PR#8466)
hi - in version 2.1 the command
>-2^2
gives
-4
as the answer. (-2)^2 is evaluated correctly.
Cheers,
George Casella
--
George Casella Phone: (352) 392-1941 Ext. 204
Distinguished Professor and Chair Cell: (352) 682-7210
Department of Statistics Fax: (352) 392-5175
University of Florida Email: casella at stat.ufl.edu
P.O. Box 118545
Gainesville, FL
2017 Nov 29
2
binary form of is() contradicts its unary form
Hi Mehmet,
On 11/29/2017 11:22 AM, Suzen, Mehmet wrote:
> Hi Herve,
>
> I think you are confusing subclasses and classes. There is no
> contradiction. `is` documentation
> is very clear:
>
> `With one argument, returns all the super-classes of this object's class.`
Yes that's indeed very clear. So if "list" is a super-class
of "data.frame" (as
2009 Jul 18
7
(-8)^(1/3) == NaN?
Why does the expression "(-8)^(1/3)" return NaN, instead of -2?
This is not answered by http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-powers-of-negative-numbers-wrong_003f
Thanks,
Dave
[[alternative HTML version deleted]]
2017 Nov 29
2
binary form of is() contradicts its unary form
Hi,
The unary forms of is() and extends() report that data.frame
extends list, oldClass, and vector:
> is(data.frame())
[1] "data.frame" "list" "oldClass" "vector"
> extends("data.frame")
[1] "data.frame" "list" "oldClass" "vector"
However, the binary form of is()
2020 May 15
3
paste(character(0), collapse="", recycle0=FALSE) should be ""
There is still the situation where **both** 'sep' and 'collapse' are
specified:
> paste(integer(0), "nth", sep="", collapse=",")
[1] "nth"
In that case 'recycle0' should **not** be ignored i.e.
paste(integer(0), "nth", sep="", collapse=",", recycle0=TRUE)
should return the empty string
2016 Mar 19
2
unary class union of an S3 class
On 03/19/2016 01:22 AM, Michael Lawrence wrote:
>
>
> On Sat, Mar 19, 2016 at 12:10 AM, Herv? Pag?s <hpages at fredhutch.org
> <mailto:hpages at fredhutch.org>> wrote:
>
> On 03/18/2016 03:28 PM, Michael Lawrence wrote:
>
>
> On Fri, Mar 18, 2016 at 2:53 PM, Herv? Pag?s
> <hpages at fredhutch.org <mailto:hpages at
2016 Mar 19
2
unary class union of an S3 class
On 03/18/2016 03:28 PM, Michael Lawrence wrote:
>
> On Fri, Mar 18, 2016 at 2:53 PM, Herv? Pag?s <hpages at fredhutch.org
> <mailto:hpages at fredhutch.org>> wrote:
>
> Hi,
>
> Short story
> -----------
>
> setClassUnion("ArrayLike", "array")
>
> showClass("ArrayLike") # no slot
>
>
2020 May 22
2
paste(character(0), collapse="", recycle0=FALSE) should be ""
Hi Martin et al,
On Thu, May 21, 2020 at 9:42 AM Martin Maechler <maechler at stat.math.ethz.ch>
wrote:
> >>>>> Herv? Pag?s
> >>>>> on Fri, 15 May 2020 13:44:28 -0700 writes:
>
> > There is still the situation where **both** 'sep' and 'collapse' are
> > specified:
>
> >> paste(integer(0),
2016 Mar 18
2
unary class union of an S3 class
Hi,
Short story
-----------
setClassUnion("ArrayLike", "array")
showClass("ArrayLike") # no slot
setClass("MyArrayLikeConcreteSubclass",
contains="ArrayLike",
representation(stuff="ANY")
)
showClass("MyArrayLikeConcreteSubclass") # 2 slots!!
That doesn't seem right.
Long story
----------
2020 May 22
2
paste(character(0), collapse="", recycle0=FALSE) should be ""
I agree with Herve, processing collapse happens last so collapse=non-NULL
always leads to a single character string being returned, the same as
paste(collapse=""). See the altPaste function I posted yesterday.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, May 22, 2020 at 9:12 AM Herv? Pag?s <hpages at fredhutch.org> wrote:
> I think that
>
>
2020 May 15
2
paste(character(0), collapse="", recycle0=FALSE) should be ""
Totally agree with that.
H.
On 5/15/20 10:34, William Dunlap via R-devel wrote:
> I agree: paste(collapse="something", ...) should always return a single
> character string, regardless of the value of recycle0. This would be
> similar to when there are no non-NULL arguments to paste; collapse="."
> gives a single empty string and collapse=NULL gives a zero long
2020 May 22
5
paste(character(0), collapse="", recycle0=FALSE) should be ""
Gabe,
It's the current behavior of paste() that is a major source of bugs:
## Add "rs" prefix to SNP ids and collapse them in a
## comma-separated string.
collapse_snp_ids <- function(snp_ids)
paste("rs", snp_ids, sep="", collapse=",")
snp_groups <- list(
group1=c(55, 22, 200),
group2=integer(0),
group3=c(99,
2017 May 03
2
stopifnot() does not stop at first non-TRUE argument
Not sure why the performance penalty of nonstandard evaluation would
be more of a concern here than for something like switch().
If that can't/won't be fixed, what about fixing the man page so it's
in sync with the current behavior?
Thanks,
H.
On 05/03/2017 02:26 AM, peter dalgaard wrote:
> The first line of stopifnot is
>
> n <- length(ll <- list(...))
>
>
2011 Apr 17
5
cube root
This is some interesting:
> -8^(1/3)
[1] -2
> x=(-8:8)
> y=x^(1/3)
> y
[1] NaN NaN NaN NaN NaN NaN NaN NaN
0.000000 1.000000
[11] 1.259921 1.442250 1.587401 1.709976 1.817121 1.912931 2.000000
So, can anybody explain this?! (Why is x[1]^(1/3)=y[1]=NaN, but
-8^(1/3)=-2?)
Thx!!!
[[alternative HTML version deleted]]
2015 Sep 29
3
making object.size() more meaningful on environments?
Hi,
Currently object.size() is not very useful on environments as it always
returns 56 bytes, no matter how big the environment is:
env1 <- new.env()
object.size(env1) # 56 bytes
env2 <- new.env(hash=TRUE, size=75000000L)
object.size(env2) # 56 bytes
env3 <- list2env(list(a=runif(25000000), L=LETTERS))
object.size(env3) # 56 bytes
This makes it pretty useless on
2018 Aug 31
2
Argument 'dim' misspelled in error message
Hi,
The following error message misspells the name of
the 'dim' argument:
> array(integer(0), dim=integer(0))
Error in array(integer(0), dim = integer(0)) :
'dims' cannot be of length 0
The name of the argument is 'dim' not 'dims':
> args(array)
function (data = NA, dim = length(data), dimnames = NULL)
NULL
Cheers,
H.
--
Herv? Pag?s
2017 May 15
2
stopifnot() does not stop at first non-TRUE argument
>>>>> Herv? Pag?s <hpages at fredhutch.org>
>>>>> on Wed, 3 May 2017 12:08:26 -0700 writes:
> On 05/03/2017 12:04 PM, Herv? Pag?s wrote:
>> Not sure why the performance penalty of nonstandard evaluation would
>> be more of a concern here than for something like switch().
> which is actually a primitive. So it seems that
2009 Jan 03
5
Power functions?
I had a question about the basic power functions in R.
For example from the R console I enter:
-1 ^ 2
[1] -1
but also
-1^3
[1] -1
-0.1^2
[1] -0.01
Normally pow(-1, 2) return either -Infinity or NaN. Has R taken over the math functions? If so I would think that -1^2 is 1 not -1 and -0.1^2 is 0.01 not -0.01.
Thank you.
Kevin
2017 May 15
3
stopifnot() does not stop at first non-TRUE argument
I see in the archives that the attachment cannot pass.
So, here is the code:
8<----
stopifnot_new <- function (...)
{
mc <- match.call()
n <- length(mc)-1
if (n == 0L)
return(invisible())
Dparse <- function(call, cutoff = 60L) {
ch <- deparse(call, width.cutoff = cutoff)
if (length(ch) > 1L)
paste(ch[1L],