similar to: stack problem

Displaying 20 results from an estimated 20000 matches similar to: "stack problem"

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)
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
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
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 <-
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
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
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 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
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 Jan 25
6
Portable R in zip file for Windows
What is wrong with you guys? I asked for a zip, like R Studio has for example. Totally clear. I cant execute exes. But I can unzip files. Thanks Gabor, I had that in mind, but can't execute the exe due to security restrictions. Geez, really, treating people who ask questions this way just makes you don't want to ask a single one. On Thu, Jan 25, 2018, 11:19 Gabor Grothendieck
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))
2018 Jul 23
2
oddity in transform
Note the inconsistency in the names in these two examples. X.Time in the first case and Time.1 in the second case. > transform(BOD, X = BOD[1:2] * seq(6)) Time demand X.Time X.demand 1 1 8.3 1 8.3 2 2 10.3 4 20.6 3 3 19.0 9 57.0 4 4 16.0 16 64.0 5 5 15.6 25 78.0 6 7 19.8 42 118.8 >
2023 Mar 08
1
Augment base::replace(x, list, value) to allow list= to be a predicate?
That's an interesting example, as it's conceptually similar to what Pavel is proposing, but structurally different. gsubfn() is more complicated than a simple switch in the body of the function, and wouldn't work well as an anonymous function. Multiple dispatch can nicely encompass both of these cases. For replace(), library(S7) replace <- new_generic("replace",
2012 Jul 26
3
rep fails on pairlist
This code which has worked for years in R but fails under R-devel: > R.version.string [1] "R Under development (unstable) (2012-07-25 r59963)" > > n <- 3 > f <- function(x) {} > formals(f) <- rep(formals(f), n) ## Error in rep(formals(f), n) : replication of pairlists is defunct The message suggests that the change was intentional. Why was this functionality
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
2016 Mar 18
1
for in r-devel
Regarding, this news item for r-devel: ?for()? loops are generalized to iterate over any object with ?[[? and ?length()? methods. Thanks to Herv? Pag?s for the idea and the patch. Below dd is an object for which [[ and length work but the result is still numeric rather than Date class in "R Under development (unstable) (2016-03-15 r70334)" as observed in the comments to:
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 <-
2018 Jan 25
0
Portable R in zip file for Windows
I believe that the ordinary Windows installer for R can produce a portable result by choosing the appropriate configuration options from the offered screens when you run the installer Be sure to enter the desired path in the Select Destination Location screen, choose Yes on the Startup options screen and ensure that all boxes are unchecked on the Select additional tasks screen. On Wed, Jan 24,