Displaying 20 results from an estimated 5000 matches similar to: "for in r-devel"
2009 Oct 13
1
for loop over S4
Hello,
Consider this :
> setClass("track", representation(x="numeric", y="numeric"))
[1] "track"
> o <- new( "track", x = 1, y = 2 )
> for( i in o ){
+ cat( "hello\n")
+ }
Error: invalid type/length (S4/1) in vector allocation
This happens at those lines of do_for:
n = LENGTH(val);
PROTECT_WITH_INDEX(v =
2019 Oct 11
1
New matrix function
The link you posted used the same inputs as in my example. If that is
not what you meant maybe
a different example is needed.
Regards.
On Fri, Oct 11, 2019 at 2:39 PM Pages, Herve <hpages at fredhutch.org> wrote:
>
> Has someone looked into the image processing area for this? That sounds
> a little bit too high-level for base R to me (and I would be surprised
> if any mainstream
2023 Nov 14
1
data.frame weirdness
Also why should that difference result in different behavior?
On Tue, Nov 14, 2023 at 9:38?AM Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> In that case identical should be FALSE but it is TRUE
>
> identical(a1, a2)
> ## [1] TRUE
>
>
> On Tue, Nov 14, 2023 at 8:58?AM Deepayan Sarkar
> <deepayan.sarkar at gmail.com> wrote:
> >
> >
2023 Nov 14
1
data.frame weirdness
On Tue, 14 Nov 2023 at 09:41, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> Also why should that difference result in different behavior?
That's justifiable, I think; consider:
> d1 = data.frame(a = 1:4)
> d2 = d3 = data.frame(b = 1:2)
> row.names(d3) = c("a", "b")
> data.frame(d1, d2)
a b
1 1 1
2 2 2
3 3 1
4 4 2
> data.frame(d1,
2023 Nov 14
1
data.frame weirdness
In that case identical should be FALSE but it is TRUE
identical(a1, a2)
## [1] TRUE
On Tue, Nov 14, 2023 at 8:58?AM Deepayan Sarkar
<deepayan.sarkar at gmail.com> wrote:
>
> They differ in whether the row names are "automatic":
>
> > .row_names_info(a1)
> [1] -3
> > .row_names_info(a2)
> [1] 3
>
> Best,
> -Deepayan
>
> On Tue, 14 Nov
2019 Oct 11
1
New matrix function
Also note that the functionality discussed could be regarded as a generalization
of matrix multiplication where * and + are general functions and in this case
we have * replaced by == and + replaced by &.
On Fri, Oct 11, 2019 at 10:46 AM Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> Using the example in the link here are two one-liners:
>
> A <-
2016 Jun 27
1
stack problem
One would normally want the original order that so that one can stack
a list, operate on the result and then unstack it back with the
unstacked result having the same ordering as the original.
LL <- list(z = 1:3, a = list())
# since we can't do s <- stack(LL,. drop = FALSE) do this instead:
s <- transform(stack(LL), ind = factor(as.character(ind), levels = names(LL)))
unstack(s)
2016 Jun 27
2
stack problem
stack() seems to drop empty levels. Perhaps there could be a
drop=FALSE argument if one wanted all the original levels. In the
example below, we may wish to retain level "b" in s$ind even though
component LL$b has length 0.
> LL <- list(a = 1:3, b = list())
> s <- stack(LL)
> str(s)
'data.frame': 3 obs. of 2 variables:
$ values: int 1 2 3
$ ind : Factor
2018 Jan 26
0
Portable R in zip file for Windows
Can you clarify what the nature of the security restriction is?
If you can't run the R installer then how it is that you could run R?
That would still involve running an external exe even if it came
in a zip file.
Could it be that the restriction is not on running exe files but on
downloading them?
If that is it then there are obvious workarounds (rename it not
to have an exe externsion or
2015 May 22
1
returnValue()
In R devel rev.66393 (2014-08-15) it was possible to do this:
trace(optim, exit = quote(str(returnValue())))
but returnValue() does not seem to be available any more. The above
was useful to get the output of a function when it was called deep
within another function that I have no control over.
Has this been replaced by some other equivalent function?
P.S. This demonstrates that it no
2018 Sep 23
1
Recall
This works:
my.compose <- function(f, ...) {
if (missing(f)) identity
else function(x) f(my.compose(...)(x))
}
my.compose(sin, cos, tan)(pi/4)
## [1] 0.5143953
sin(cos(tan(pi/4)))
## [1] 0.5143953
But replacing my.compose with Recall in the else causes it to fail:
my.compose2 <- function(f, ...) {
if (missing(f)) identity
else function(x) f(Recall(...)(x))
2023 Nov 14
1
data.frame weirdness
They differ in whether the row names are "automatic":
> .row_names_info(a1)
[1] -3
> .row_names_info(a2)
[1] 3
Best,
-Deepayan
On Tue, 14 Nov 2023 at 08:23, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>
> What is going on here? In the lines ending in #### the inputs and outputs
> are identical yet one gives a warning and the other does not.
>
>
2018 Jan 26
2
Portable R in zip file for Windows
Pretty good question Gabor. I can execute R once it is installed (if
someone with rights installs it before) but not the installer. I can
download the installer (with some pain). I know that some installers are
actually compressed files in disguise, but I think this is not the case
with R, right?
I will study the exact nature of the restriction, and get back to you.
Nevertheless, having a
2008 May 13
0
[LLVMdev] Iterator protocols
On May 12, 2008, at 6:49 PM, Talin wrote:
> So the question is, what's the trade-off. In most languages that
> support
> exceptions, you tend to think of exceptions as expensive operations
> that
> should only be thrown if something truly "exceptional" happens. OTOH,
> the Java case is also made worse by the fact that a large part of the
> time you'll be
2018 Jul 29
2
odd behavior of names
The first component name has backticks around it and the second does
not. Though not wrong, it seems inconsistent.
list(a = 1, b = 2)
## $`a`
## [1] 1
##
## $b
## [1] 2
R.version.string
## [1] "R version 3.5.1 Patched (2018-07-02 r74950)"
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
2018 Jul 24
2
oddity in transform
The idea is that one wants to write the line of code below
in a general way which works the same
whether you specify ix as one column or multiple columns but the naming entirely
changes when you do this and BOD[, 1] and transform(BOD, X=..., Y=...) or
other hard coding solutions still require writing multiple cases.
ix <- 1:2
transform(BOD, X = BOD[ix] * seq(6))
On Tue, Jul 24, 2018 at
2008 May 13
6
[LLVMdev] Iterator protocols
This is related to the general question of efficiency of unwinds. I'm
mulling over whether to use the Java-style or Python-style iterator
protocol for my language. The Python style is to have a special
exception (StopIteration) that is thrown when the end of the sequence is
reached. The Java style is to have a separate "hasNext" method on the
iterator object that says whether or
2011 Apr 29
1
error while checking package size during Rcmd check
I am receiving this message during
Rcmd check proto-3.9.2.tar.gz
using "R version 2.13.0 Patched (2011-04-25 r55638)"
* checking installed package size ...Error in if (total > 1024 * 5) { : missing
value where TRUE/FALSE needed
Execution halted
I don't get this under R.2.12.x. The size of the tar.gz file is under
600K. What causes this or if its too hard to tell from the
2011 Dec 01
1
Standardizing included packages
It seems that R is mostly distributed with the tcltk package but not always.
Is there some reason for this inconsistency?
It would be nice if one could count on those packages that are
distributed on the Windows version of R being distributed on all other
platforms too.
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
2023 Nov 14
1
data.frame weirdness
What is going on here? In the lines ending in #### the inputs and outputs
are identical yet one gives a warning and the other does not.
a1 <- `rownames<-`(anscombe[1:3, ], NULL)
a2 <- anscombe[1:3, ]
ix <- 5:8
# input arguments to #### are identical in both cases
identical(stack(a1[ix]), stack(a2[ix]))
## [1] TRUE
identical(a1[-ix], a2[-ix])
## [1] TRUE
res1 <-