[Rd] pipes and setNames

2022-04-17 Thread Gabor Grothendieck
When trying to transform names in a pipeline one can do the following where for this example we are making names upper case. BOD |> (\(x) setNames(x, toupper(names(x() but that seems a bit ugly and verbose. 1. One possibility is to enhance setNames to allow a function as a second

[Rd] aggregate.formula and pipes

2022-01-26 Thread Gabor Grothendieck
Because aggregate.formula has a formula argument but the generic has an x argument neither of these work: mtcars |> aggregate(x = mpg ~ cyl, FUN = mean) mtcars |> aggregate(formula = mpg ~ cyl, FUN = mean) This does work: mtcars |> stats:::aggregate.formula(formula = mpg ~ cyl, FUN =

[Rd] assignment

2021-12-27 Thread Gabor Grothendieck
In a recent SO post this came up (changed example to simplify it here). It seems that `test` still has the value sin. test <- sin environment(test)$test <- cos test(0) ## [1] 0 It appears to be related to the double use of `test` in `$<-` since if we break it up it works as expected:

Re: [R-pkg-devel] socketConnection, delay when reading from

2021-11-27 Thread Gabor Grothendieck
s not been completely returned. > > In R you can set the timeout to 0 but that results in errors (at least > on Windows) > > Op 27-11-2021 om 14:57 schreef Gabor Grothendieck: > > Does the message start with a length or a command whose argument length is > > known >

Re: [R-pkg-devel] socketConnection, delay when reading from

2021-11-27 Thread Gabor Grothendieck
Does the message start with a length or a command whose argument length is known depending on the particular command? If so first read the length or command and from that the length of the remainder of the message can be determined. On Sat, Nov 27, 2021 at 4:09 AM Ben Engbers wrote: > > > Hi, >

Re: [Rd] order of operations

2021-08-27 Thread Gabor Grothendieck
order is not guaranteed should be > flagged by the language at compile time (or when interpreted) and refuse to > go on. > > All I can say with computer languages and adding ever more features, > with greater power comes greater responsibility and often greater > confusion. > > > ---

Re: [Rd] order of operations

2021-08-27 Thread Gabor Grothendieck
asonable answer can be extracted from a given body of data. > ~ John Tukey > > /// > > <https://www.inbo.be> > > > Op vr 27 aug. 2021 om 17:18 schreef Gabor Grothendieck < > ggrothendi...@gmail.com>: > >> Are there any guarantees of wh

[Rd] order of operations

2021-08-27 Thread Gabor Grothendieck
Are there any guarantees of whether x will equal 1 or 2 after this is run? (x <- 1) * (x <- 2) ## [1] 2 x ## [1] 2 -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __

[Rd] problem with pipes, textConnection and read.dcf

2021-08-10 Thread Gabor Grothendieck
This gives an error bit if the first gsub line is commented out then there is no error even though it is equivalent code. L <- c("Variable:id", "Length:112630 ") L |> gsub(pattern = " ", replacement = "") |> gsub(pattern = " ", replacement = "") |> textConnection() |>

Re: [Rd] Feature request: Change default library path on Windows

2021-07-25 Thread Gabor Grothendieck
At the very least it would be nice if there were a function that displays all the locations/paths currently being used in R. On Sat, Jul 24, 2021 at 6:15 PM Steve Haroz wrote: > > Hello, > > I'd like to propose moving the default library install location on Windows > from: >

Re: [Rd] S3 weirdness

2021-06-24 Thread Gabor Grothendieck
e_0.20-44 > > which includes S3 method dispatch tables: > > > methods(as.ts) > [1] as.ts.default* as.ts.zoo* as.ts.zooreg* > see '?methods' for accessing help and source code > > so the behavior is as expected. > > Cheers, > Simon > > > > On 25/06/2021, a

[Rd] S3 weirdness

2021-06-24 Thread Gabor Grothendieck
If we start up a vanilla session of R with no packages loaded and type the single line of code below as the first line entered then we get the output shown below. The NA in the output and the length of 7 indicate that as.ts dispatched as.ts.zoo since as.ts.default would have resulted in a length

Re: [Rd] Additional an example for the forward pipe operator's documentation

2021-06-19 Thread Gabor Grothendieck
These also work in this particular case although not in general and the Call: line in the output differs: mtcars |> subset(cyl == 4) |> with(lm(mpg ~ disp)) mtcars |> with(lm(mpg ~ disp, subset = cyl == 4)) On Sat, Jun 19, 2021 at 7:23 AM Erez Shomron wrote: > > Hello, > > > While playing

Re: [Rd] reshape documentation

2021-04-11 Thread Gabor Grothendieck
One thing about varying is that reshape ignores the names on the varying list and makes you specify them all over again even though it could know what they are. Note that we had to specify that names(varying) is the v.names. DF <- structure(list(A1 = 10L, A2 = 5L, B1 = 11L, B2 = 5L, C1 = 21L,

[Rd] replicate evaluates its second argument in wrong environment

2021-02-13 Thread Gabor Grothendieck
Currently replicate used within sapply within a function can fail because it gets the environment for its second argument, which is currently hard coded to be the parent frame, wrong. See this link for a full example of how it goes wrong and how it could be made to work if it were possible to

Re: [Rd] brief update on the pipe operator in R-devel

2021-01-15 Thread Gabor Grothendieck
These are documented but still seem like serious deficiencies: > f <- function(x, y) x + 10*y > 3 |> x => f(x, x) Error in f(x, x) : pipe placeholder may only appear once > 3 |> x => f(1+x, 1) Error in f(1 + x, 1) : pipe placeholder must only appear as a top-level argument in the RHS call

Re: [Rd] [External] Re: New pipe operator

2020-12-09 Thread Gabor Grothendieck
On Wed, Dec 9, 2020 at 12:36 PM Gabriel Becker wrote: > I mean, I think the bizarro pipe was a pretty clever piece of work. I was > impressed by what John did there, but I don't really know what you're > suggesting here. As you say, the bizarro pipe works now without any changes > and you're

Re: [Rd] [External] Re: New pipe operator

2020-12-09 Thread Gabor Grothendieck
On Wed, Dec 9, 2020 at 10:08 AM Duncan Murdoch wrote: > > You might be interested in this blog post by Michael Barrowman: > > https://michaelbarrowman.co.uk/post/the-new-base-pipe/ > > He does some timing comparisons, and the current R-devel implementations > of |> and \() do quite well. It does

Re: [Rd] the pipe |> and line breaks in pipelines

2020-12-09 Thread Gabor Grothendieck
On Wed, Dec 9, 2020 at 4:03 AM Timothy Goodman wrote: > But the bigger issue happens when I want to re-run just *part* of the > pipeline. Insert one of the following into the pipeline. It does not require that you edit any lines. It only involves inserting a line. print %>% { str(.); . }

Re: [Rd] [External] Re: New pipe operator

2020-12-08 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 9:09 AM Gabor Grothendieck wrote: > > On Sat, Dec 5, 2020 at 1:19 PM wrote: > > Let's get some experience > > Here is my last SO post using dplyr rewritten to use R 4.1 devel. Seems It occurred to me it would also be interesting to show this example re

Re: [Rd] [External] anonymous functions

2020-12-08 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 12:34 PM wrote: > I don't disagree in principle, but the reality is users want shortcuts > and as a result various packages, in particular tidyverse, have been > providing them. Mostly based on formulas, mostly with significant > issues since formulas weren't designed for

Re: [Rd] New pipe operator

2020-12-08 Thread Gabor Grothendieck
Duncan Murdoch: > I agree it's all about call expressions, but they aren't all being > treated equally: > > x |> f(...) > > expands to f(x, ...), while > > x |> `function`(...) > > expands to `function`(...)(x). This is an exception to the rule for Yes, this is the problem. It is trying to

Re: [Rd] New pipe operator

2020-12-07 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 2:02 PM Kevin Ushey wrote: > > IMHO the use of anonymous functions is a very clean solution to the > placeholder problem, and the shorthand lambda syntax makes it much > more ergonomic to use. Pipe implementations that crawl the RHS for > usages of `.` are going to be more

Re: [Rd] New pipe operator

2020-12-07 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 12:54 PM Duncan Murdoch wrote: > An advantage of the current implementation is that it's simple and easy > to understand. Once you make it a user-modifiable binary operator, > things will go kind of nuts. > > For example, I doubt if there are many users of magrittr's pipe

Re: [Rd] anonymous functions

2020-12-07 Thread Gabor Grothendieck
It is easier to understand a function if you can see the entire function body at once on a page or screen and excessive verbosity interferes with that. On Mon, Dec 7, 2020 at 12:04 PM Therneau, Terry M., Ph.D. via R-devel wrote: > > “The shorthand form \(x) x + 1 is parsed as function(x) x + 1.

Re: [Rd] [External] Re: New pipe operator

2020-12-07 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 10:11 AM wrote: > Or, keeping dplyr but with R-devel pipe and function shorthand: > > DF <- "myfile.csv" %>% > readLines() |> > \(.) gsub(r'{(c\(.*?\)|integer\(0\))}', r'{"\1"}', .) |> > \(.) read.csv(text = .) |> > mutate(across(2:3, \(col) lapply(col, \(x)

Re: [Rd] New pipe operator

2020-12-07 Thread Gabor Grothendieck
One could examine how magrittr works as a reference implementation if there is a question on how something should function. It's in widespread use and seems to work well. On Mon, Dec 7, 2020 at 10:20 AM Deepayan Sarkar wrote: > > On Mon, Dec 7, 2020 at 6:53 PM Gabor Grothendieck &g

Re: [Rd] [External] Re: New pipe operator

2020-12-07 Thread Gabor Grothendieck
On Sat, Dec 5, 2020 at 1:19 PM wrote: > Let's get some experience Here is my last SO post using dplyr rewritten to use R 4.1 devel. Seems not too bad. Was able to work around the placeholder for gsub by specifying the arg names and used \(...)... elsewhere. This does not address the

Re: [Rd] New pipe operator

2020-12-07 Thread Gabor Grothendieck
On Mon, Dec 7, 2020 at 5:41 AM Duncan Murdoch wrote: > I agree it's all about call expressions, but they aren't all being > treated equally: > > x |> f(...) > > expands to f(x, ...), while > > x |> `function`(...) > > expands to `function`(...)(x). This is an exception to the rule for > other

Re: [Rd] New pipe operator

2020-12-06 Thread Gabor Grothendieck
This is really irrelevant. On Sun, Dec 6, 2020 at 9:23 PM Gabriel Becker wrote: > > Hi Gabor, > > On Sun, Dec 6, 2020 at 3:22 PM Gabor Grothendieck > wrote: >> >> I understand very well that it is implemented at the syntax level; >> however, in any case

Re: [Rd] New pipe operator

2020-12-06 Thread Gabor Grothendieck
ter of breaking the way R works as a functional language with first class functions. On Sun, Dec 6, 2020 at 4:06 PM Gabriel Becker wrote: > > Hi Gabor, > > On Sun, Dec 6, 2020 at 12:52 PM Gabor Grothendieck > wrote: >> >> I think the real issue here is that functions

Re: [Rd] New pipe operator

2020-12-06 Thread Gabor Grothendieck
ing it can change that inconsistency which seems serious to me and needs to be addressed even if it complicates the implementation since it drives to the heart of what R is. On Sat, Dec 5, 2020 at 1:08 PM Gabor Grothendieck wrote: > > The construct utils::head is not that common but bare

Re: [Rd] [External] Re: New pipe operator

2020-12-06 Thread Gabor Grothendieck
Why is that ambiguous? It works in magrittr. > library(magrittr) > 1 %>% `+`() [1] 1 On Sun, Dec 6, 2020 at 1:09 PM wrote: > > On Sun, 6 Dec 2020, Gabor Grothendieck wrote: > > > The following gives an error. > > > > 1 |> `+`(2) > > ## Err

Re: [Rd] [External] Re: New pipe operator

2020-12-06 Thread Gabor Grothendieck
The following gives an error. 1 |> `+`(2) ## Error: function '+' is not supported in RHS call of a pipe 1 |> `+`() ## Error: function '+' is not supported in RHS call of a pipe but this does work: 1 |> (`+`)(2) ## [1] 3 1 |> (`+`)() ## [1] 1 The error message suggests

Re: [Rd] installling R-devel on Windows

2020-12-06 Thread Gabor Grothendieck
I meant on the R devel download page. (I was just installing Rtools40 on another computer.) On Sun, Dec 6, 2020 at 10:27 AM Gabor Grothendieck wrote: > > I tried it from another computer and it did work. Is there some way > of installing R devel using the analog of the R --vanill

Re: [Rd] installling R-devel on Windows

2020-12-06 Thread Gabor Grothendieck
to what occurs. I don't see anything documenting flags on the Rtools40 page. On Sat, Dec 5, 2020 at 9:52 AM Gabor Grothendieck wrote: > > I clicked on the download link at > https://cran.r-project.org/bin/windows/base/rdevel.html > and then opened the downloaded file which starts the

Re: [Rd] as.POSIXct.numeric change default of origin argument

2020-12-06 Thread Gabor Grothendieck
For example, this works: library(zoo) as.Date(0) ## [1] "1970-01-01" On Sun, Dec 6, 2020 at 7:10 AM Achim Zeileis wrote: > > On Sun, 6 Dec 2020, Jan Gorecki wrote: > > > Hello all, > > > > I would like to propose to change the default value for "origin" > > argument in as.POSIXct.numeric

Re: [Rd] New pipe operator

2020-12-05 Thread Gabor Grothendieck
The construct utils::head is not that common but bare functions are very common and to make it harder to use the common case so that the uncommon case is slightly easier is not desirable. Also it is trivial to write this which does work: mtcars %>% (utils::head) On Sat, Dec 5, 2020 at 11:59 AM

Re: [Rd] installling R-devel on Windows

2020-12-05 Thread Gabor Grothendieck
encountered this. On Sat, Dec 5, 2020 at 9:13 AM Jeroen Ooms wrote: > > On Sat, Dec 5, 2020 at 3:00 PM Gabor Grothendieck > wrote: > > > > When I try to install r-devel on Windows all I get is this. No other > > files. This also occurred yesterday as well. >

[Rd] installling R-devel on Windows

2020-12-05 Thread Gabor Grothendieck
When I try to install r-devel on Windows all I get is this. No other files. This also occurred yesterday as well. Directory of C:\Program Files\R\R-test 12/05/2020 08:56 AM . 12/05/2020 08:56 AM .. 12/05/2020 08:56 AM11,503 unins000.dat 12/05/2020

Re: [R-pkg-devel] import with except(ion)

2020-10-31 Thread Gabor Grothendieck
coxreg could search for frailty and issue a warning or error if found. This returns TRUE if frailty is used in the formula argument as a function but not otherwise. That would allow implementation of a nicer message than if it were just reported as a missing function. find_frailty <-

Re: [Rd] ftable <-> data.frame etc {was "justify hard coded in format.ftable"}

2020-05-23 Thread Gabor Grothendieck
emale 89 19 ## 3 B Male 353 207 ## 4 B Female 178 ## ... etc ... Fri, May 15, 2020 at 12:25 PM Martin Maechler wrote: > > >>>>> Gabor Grothendieck > >>>>> on Thu, 14 May 2020 06:56:06 -0400 writ

Re: [Rd] justify hard coded in format.ftable

2020-05-15 Thread Gabor Grothendieck
If you are looking at ftable could you also consider adding a way to convert an ftable into a usable data.frame such as the ftable2df function defined here: https://stackoverflow.com/questions/11141406/reshaping-an-array-to-data-frame/11143126#11143126 and there is an example of using it here:

Re: [Rd] justify hard coded in format.ftable

2020-05-15 Thread Gabor Grothendieck
One can use as.data.frame(as.matrix(tab)) to avoid calling as.data.frame.matrix directly (although I find I do use as.data.frame.matrix anyways sometimes even though it is generally better to call the generic.). Also note that the various as.data.frame methods do not address the examples in the

Re: [Rd] suggestion: "." in [lsv]apply()

2020-04-20 Thread Gabor Grothendieck
ses. library(sqldf) mytime <- 4 fn$sqldf("select * from BOD where Time < $mytime") On Mon, Apr 20, 2020 at 9:32 AM Sokol Serguei wrote: > > Le 19/04/2020 à 20:46, Gabor Grothendieck a écrit : > > You can get pretty close to that already using fn$ in the gsubfn package:

Re: [Rd] suggestion: "." in [lsv]apply()

2020-04-19 Thread Gabor Grothendieck
You can get pretty close to that already using fn$ in the gsubfn package: > library(gsubfn) > fn$sapply(split(mtcars, mtcars$cyl), x ~ summary(lm(mpg ~ wt, x))$r.squared) 4 6 8 0.5086326 0.4645102 0.4229655 It is not specific to sapply but rather fn$ can preface most

Re: [Rd] New matrix function

2019-10-11 Thread Gabor Grothendieck
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 wrote: > > Has someone looked into the image processing area for this? That sounds > a little bit too high-level for

Re: [Rd] New matrix function

2019-10-11 Thread Gabor Grothendieck
I pressed return too soon. If we had such a multiply then which(embed(A, x) %==.&% reverse(x)) On Fri, Oct 11, 2019 at 10:57 AM Gabor Grothendieck wrote: > > Also note that the functionality discussed could be regarded as a > generalization > of matrix mult

Re: [Rd] New matrix function

2019-10-11 Thread Gabor Grothendieck
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 wrote: > > Using t

Re: [Rd] New matrix function

2019-10-11 Thread Gabor Grothendieck
Using the example in the link here are two one-liners: A <- c(2,3,4,1,2,3,4,1,1,2) x <- c(1,2) # 1 - zoo library(zoo) which( rollapply(A, length(x), identical, x, fill = FALSE, align = "left") ) ## [1] 4 9 # 2 - Base R using conversion to character gregexpr(paste(x, collapse =

Re: [Rd] Recall

2018-09-23 Thread Gabor Grothendieck
Please ignore. Looking at this again I realize the problem is that Recall is not direclty within my.compose2 but rather is within the anonymous function in the else. On Sun, Sep 23, 2018 at 9:23 AM Gabor Grothendieck wrote: > > This works: > > my.compose <- function(f, ...) { &g

[Rd] Recall

2018-09-23 Thread Gabor Grothendieck
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:

Re: [Rd] apply with zero-row matrix

2018-07-30 Thread Gabor Grothendieck
Try pmap and related functions in purrr: pmap(as.data.frame(m), ~ { cat("Called...\n"); print(c(...)) }) ## list() On Mon, Jul 30, 2018 at 12:33 AM, David Hugh-Jones wrote: > Forgive me if this has been asked many times before, but I couldn't find > anything on the mailing lists. > > I'd

[Rd] odd behavior of names

2018-07-29 Thread Gabor Grothendieck
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

Re: [Rd] oddity in transform

2018-07-24 Thread Gabor Grothendieck
nl <mailto:i...@dans.kn> | dans.knaw.nl > > DANS is an institute of the Dutch Academy KNAW <http://knaw.nl/nl> and > funding organisation NWO <http://www.nwo.nl/>. > > On 23/07/2018, 16:52, "R-devel on behalf of Gabor Grothendieck" > wrote: > >

[Rd] oddity in transform

2018-07-23 Thread Gabor Grothendieck
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 118.3 1 8.3 22 10.3 4 20.6 33 19.0 9 57.0 44

Re: [Rd] A few suggestions and perspectives from a PhD student

2017-05-05 Thread Gabor Grothendieck
Regarding the anonymous-function-in-a-pipeline point one can already do this which does use brackets but even so it involves fewer characters than the example shown. Here { . * 2 } is basically a lambda whose argument is dot. Would this be sufficient? library(magrittr) 1.5 %>% { . * 2 }

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Gabor Grothendieck
If xtabs is enhanced then as.data.frame.table may also need to be modified so that it continues to be usable as an inverse, at least to the degree feasible. On Thu, Jan 26, 2017 at 5:42 AM, Martin Maechler wrote: > Last week, we've talked here about "xtabs(), factors

Re: [Rd] On implementing zero-overhead code reuse

2016-10-03 Thread Gabor Grothendieck
Have a look at the CRAN modules package and the import package. On Sun, Oct 2, 2016 at 1:29 PM, Kynn Jones wrote: > I'm looking for a way to approximate the "zero-overhead" model of code > reuse available in languages like Python, Perl, etc. > > I've described this idea in more

Re: [Rd] strcapture enhancement

2016-09-21 Thread Gabor Grothendieck
Note that read.pattern in gsubfn does accept stringsAsFactors = FALSE, e.g. using your input lines and pattern: library(gsubfn) Lines <- c("Three 3", "Twenty 20") pat <- "([[:alpha:]]*) +([[:digit:]]*)" s2 <- read.pattern(text = Lines, pattern = pat, stringsAsFactors = FALSE, col.names =

Re: [Rd] stack problem

2016-06-27 Thread Gabor Grothendieck
els to unique(names(x)) or sort them, > too? > > On Mon, Jun 27, 2016 at 10:39 AM, Gabor Grothendieck > <ggrothendi...@gmail.com> wrote: >> stack() seems to drop empty levels. Perhaps there could be a >> drop=FALSE argument if one wanted all the original levels. In t

[Rd] stack problem

2016-06-27 Thread Gabor Grothendieck
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)

[Rd] ctrl-R in Rgui

2016-05-05 Thread Gabor Grothendieck
When in the Rgui editor sometimes ctrl-R does not cause anything to be sent to the R console. It can be reproduced like this: - when in the Rgui console press ctrl-F N to get a new editor window - enter: pi + 3 followed by Enter - while still in the editor window press ctrl-A ctrl-R and pi + 3

[Rd] for in r-devel

2016-03-18 Thread Gabor Grothendieck
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

Re: [Rd] Puzzled by eval

2015-11-06 Thread Gabor Grothendieck
This code which I think I wrote but might have gotten from elsewhere a long time ago shows the environments that are searched from a given function, in this case chart.RelativePerformance in PerformanceAnalytics package. Try it on some of your functions in and out of packages to help determine

Re: [Rd] returnValue()

2015-05-22 Thread Gabor Grothendieck
Please disregard. I was running an older version of R at the time. In R version 3.2.0 Patched (2015-04-19 r68205) returnValue() does work. On Fri, May 22, 2015 at 6:25 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: In R devel rev.66393 (2014-08-15) it was possible to do this: trace

[Rd] returnValue()

2015-05-22 Thread Gabor Grothendieck
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

Re: [Rd] xtabs and NA

2015-02-09 Thread Gabor Grothendieck
On Mon, Feb 9, 2015 at 8:52 AM, Kirill Müller kirill.muel...@ivt.baug.ethz.ch wrote: Hi I haven't found a way to produce a tabulation from factor data with NA values using xtabs. Please find a minimal example below, it's also on R-pubs [1]. Tested with R 3.1.2 and R-devel r67720. It

Re: [Rd] CRAN and ggplot2 geom and stat extensions

2014-12-23 Thread Gabor Grothendieck
On Tue, Dec 23, 2014 at 11:21 AM, Ista Zahn istaz...@gmail.com wrote: On Tue, Dec 23, 2014 at 10:34 AM, Frank Harrell f.harr...@vanderbilt.edu wrote: I am thinking about adding several geom and stat extensions to ggplot2 in the Hmisc package. To do this requires using non-exported ggplot2

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gabor Grothendieck
On Fri, Oct 31, 2014 at 7:34 PM, Gábor Csárdi csardi.ga...@gmail.com wrote: Dear All, I am trying to do the following, and could use some hints. Suppose I have a package called pkgA. pkgA exposes an API that includes setting some options, e.g. pkgA works with color palettes, and the user of

Re: [Rd] Options that are local to the package that sets them

2014-10-31 Thread Gabor Grothendieck
On Fri, Oct 31, 2014 at 8:43 PM, Gábor Csárdi csardi.ga...@gmail.com wrote: On Fri, Oct 31, 2014 at 8:10 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: [...] Is there a better way? I have a feeling that this is already supported somehow, I just can't find out how. Try the settings

Re: [Rd] Using Rtools with gcc 4.8.3

2014-10-05 Thread Gabor Grothendieck
On Sun, Oct 5, 2014 at 6:51 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 05.10.2014 12:20, Jeroen Ooms wrote: I started working on some R bindings for mongo-c-driver [1]. The C library compiles fine on Ubuntu Trusty (gcc 4.8.2) and osx (clang), however on my windows machine (gcc

Re: [Rd] Re R CMD check checking in development version of R

2014-08-28 Thread Gabor Grothendieck
Yes, Depends certainly has a role. The ability of one package to automatically provide all the facilities of another package to the user is important. There are many situations where the functionality you want to provide to the user is split among multiple packages. For example, 1. xts uses zoo

Re: [Rd] Licence for datasets in a R-package

2014-07-21 Thread Gabor Grothendieck
On Mon, Jul 21, 2014 at 12:54 PM, Gábor Csárdi csardi.ga...@gmail.com wrote: In practice, CRAN maintainers do not allow multiple licenses for parts of the same package. At least they did not for my package a couple of months ago. If that is the case then you could put your data files in a

[Rd] useDynLib

2014-07-06 Thread Gabor Grothendieck
I would like to be able to load two versions of a package at once and to do that was thinking of giving each version a different package name in the DESCRIPTION file and the building and installing each such version separately. library(myPkg1) library(myPkg2) and then use myPkg1::myFun() and

Re: [Rd] type.convert and doubles

2014-04-19 Thread Gabor Grothendieck
On Sat, Apr 19, 2014 at 1:06 PM, Simon Urbanek simon.urba...@r-project.org wrote: On Apr 19, 2014, at 9:00 AM, Martin Maechler maech...@stat.math.ethz.ch wrote: I think there should be two separate discussions: a) have an option (argument to type.convert and possibly read.table) to

Re: [Rd] Can the output of Sys.getenv() be improved?

2014-04-18 Thread Gabor Grothendieck
On Fri, Apr 18, 2014 at 12:38 PM, Zhang,Jun jhzh...@mdanderson.org wrote: Within an R session, type Sys.getenv() will list all the environment variables, but each one of them occupies about a page, so scrolling to find one is difficult. Is this because I don't know how to use it or something

Re: [Rd] type.convert and doubles

2014-04-17 Thread Gabor Grothendieck
On Thu, Apr 17, 2014 at 2:21 PM, Murray Stokely mur...@stokely.org wrote: If you later want to do arithmetic on them, you can choose to lose precision by using as.numeric() or use one of the large number packages on CRAN (GMP, int64, bit64, etc.). But once you've dropped the precision with

Re: [Rd] R 3.1.0 and C++11

2014-04-10 Thread Gabor Grothendieck
On Tue, Oct 29, 2013 at 1:58 AM, rom...@r-enthusiasts.com wrote: Le 2013-10-29 03:01, Whit Armstrong a écrit : I would love to see optional c++0x support added for R. c++0x was the name given for when this was in development. Now c++11 is a published standard backed by implementations by

Re: [Rd] file.exists does not like path names ending in /

2014-01-17 Thread Gabor Grothendieck
On Fri, Jan 17, 2014 at 6:16 AM, Martin Maechler maech...@stat.math.ethz.ch wrote: Gabor Grothendieck ggrothendi...@gmail.com on Fri, 17 Jan 2014 00:10:43 -0500 writes: If a path name ends in slash then file.exists says it does not exist. I would have expected these to all

[Rd] file.exists does not like path names ending in /

2014-01-16 Thread Gabor Grothendieck
If a path name ends in slash then file.exists says it does not exist. I would have expected these to all return TRUE. file.exists(/Program Files) [1] TRUE file.exists(/Program Files/) [1] FALSE file.exists(normalizePath(/Program Files/)) [1] FALSE R.version.string [1] R version 3.0.2 Patched

[Rd] win.version() incorrect

2014-01-16 Thread Gabor Grothendieck
On Windows 8.1 I get this. win.version() indicates build 9200 but I actually have build 9600 as can be seen from the ver command. shell(winver) also indicates 9600. I assume ver and winver are correct and win.version() is not. win.version() [1] Windows 8 x64 (build 9200) shell(ver)

Re: [Rd] In-string variable/symbol substitution: What formats/syntax is out there?

2013-12-17 Thread Gabor Grothendieck
On Tue, Dec 17, 2013 at 4:44 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'm try to collect a list of methods/packages available in R for doing in-string variable/symbol substitution, e.g. someFcn(pi=${pi}), anotherFcn(pi=@pi@) and so on becomes pi=3.141593. I am aware of the

Re: [Rd] Depending/Importing data only packages

2013-12-07 Thread Gabor Grothendieck
On Sat, Dec 7, 2013 at 1:35 PM, Paul Gilbert pgilbert...@gmail.com wrote: On 13-12-07 12:19 PM, Gábor Csárdi wrote: I don't know about this particular case, but in general it makes sense to rely on a data package. E.g. I am creating a package that does Bayesian inference for a particular

Re: [Rd] Huge performance difference between implicit and explicit print

2013-10-30 Thread Gabor Grothendieck
On Wed, Oct 30, 2013 at 6:22 PM, Hadley Wickham h.wick...@gmail.com wrote: Hi all, Can anyone help me understand why an implicit print (i.e. just typing df at the console), is so much slower than an explicit print (i.e. print(df)) in the example below? I see the difference in both Rstudio

Re: [Rd] Multivariate time series in R 3 vs R 2

2013-10-26 Thread Gabor Grothendieck
On Wed, Oct 23, 2013 at 2:56 PM, Андрей Парамонов cmr.p...@gmail.com wrote: Hello! Recently I got report that my package mar1s doesn't pass checks any more on R 3.0.2. I started to investigate and found the following difference in multivariate time series handling in R 3.0.2 compared to R 2

Re: [Rd] Question about selective importing of package functions...

2013-10-20 Thread Gabor Grothendieck
On Sun, Oct 20, 2013 at 4:49 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-10-20 4:43 PM, Jonathan Greenberg wrote: I'm working on an update for my CRAN package spatial.tools and I noticed a new warning when running R CMD CHECK --as-cran: * checking CRAN incoming feasibility ...

Re: [Rd] legitimate use of :::

2013-08-22 Thread Gabor Grothendieck
If ::: is disallowed then its likely that package developers will need to export more functions to satisfy the consumers of those otherwise hidden functions but if more functions are exported then there will be a greater likelihood of conflicts among packages. The problem seems to be that there

Re: [Rd] legitimate use of :::

2013-08-22 Thread Gabor Grothendieck
is importFrom() and it should be used. On Aug 22, 2013, at 6:27 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: If ::: is disallowed then its likely that package developers will need to export more functions to satisfy the consumers of those otherwise hidden functions but if more

Re: [Rd] legitimate use of :::

2013-08-22 Thread Gabor Grothendieck
On Thu, Aug 22, 2013 at 7:57 PM, Gabriel Becker gmbec...@ucdavis.edu wrote: My understanding is that lookup happens in the imports before moving on to the search path, so if I understand you correctly I don't think that is an issue. If A also *exported* f, that would be a problem... A can

Re: [Rd] Extending suggestion for stopifnot

2013-08-20 Thread Gabor Grothendieck
On Tue, Aug 20, 2013 at 6:00 PM, ivo welch ivo.we...@gmail.com wrote: character string at the end of an existing function, stopifnot(). (2) I think estrings (that behave like characters but are interpolated before printout) are useful in the same way perl interpolated strings are useful. The

Re: [Rd] Redirect system2 stdout to a file on windows

2013-07-14 Thread Gabor Grothendieck
On Sun, Jul 14, 2013 at 1:18 PM, Jeroen Ooms jeroen.o...@stat.ucla.edu wrote: According to the manual, the `stdout` argument of the `system2` function can redirect output to a file. This seems to work on unix, however I can't get it to work on windows. The toy example below, no `out.txt` or

Re: [Rd] Redirect system2 stdout to a file on windows

2013-07-14 Thread Gabor Grothendieck
On Sun, Jul 14, 2013 at 5:20 PM, Jeroen Ooms jeroen.o...@stat.ucla.edu wrote: On Sun, Jul 14, 2013 at 10:24 PM, Gabor Grothendieck wrote: Try: out.txt - normalizePath(./out.txt, mustWork = FALSE) Doesn't work either, neither on Win7 nor WinXP. sessionInfo() R version 3.0.1 (2013-05-16

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-22 Thread Gabor Grothendieck
On Mon, Apr 22, 2013 at 10:27 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 21/04/2013 6:57 PM, Hadley Wickham wrote: PS. Hadley, is this what you meant when you wrote Better solutions (e.g. Rstudio and devtools) temporarily set the path on when you're calling R CMD *., or those

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-21 Thread Gabor Grothendieck
On Sun, Apr 21, 2013 at 8:18 AM, Hadley Wickham h.wick...@gmail.com wrote: The problem is that if you don't just use the PC for running R but use it to run other programs too then any program and that utilizes Windows batch scripts making use of find.exe or sort.exe likely won't work if Rtools

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-21 Thread Gabor Grothendieck
On Sun, Apr 21, 2013 at 9:49 AM, Hadley Wickham h.wick...@gmail.com wrote: Because it can conflict with other Windows software unless you add a layer over it. What other popular software that runs on Windows has these problems? I can't think of any. The closest I can come up with was that

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-21 Thread Gabor Grothendieck
On Sun, Apr 21, 2013 at 12:57 PM, Hadley Wickham h.wick...@gmail.com wrote: Because it can conflict with other Windows software unless you add a layer over it. What other popular software that runs on Windows has these problems? I can't think of any. The closest I can come up with was that

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-21 Thread Gabor Grothendieck
On Sun, Apr 21, 2013 at 6:17 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: I (as well) keep a specific Rsetup.bat file for launching Windows cmd.exe with the proper PATH etc setup for build R packages etc. It's only after this thread I gave it a second thought; you can indeed temporarily

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-20 Thread Gabor Grothendieck
On Sat, Apr 20, 2013 at 10:45 AM, Hadley Wickham h.wick...@gmail.com wrote: Just curious: how often do you use the Windows find command? We have put instructions in place for people to run the install process with a renamed Rtools find command (which I think is the only conflict). The issue

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-20 Thread Gabor Grothendieck
On Sat, Apr 20, 2013 at 11:49 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-04-20 11:09 AM, Gabor Grothendieck wrote: On Sat, Apr 20, 2013 at 10:45 AM, Hadley Wickham h.wick...@gmail.com wrote: Just curious: how often do you use the Windows find command? We have put

  1   2   3   4   5   6   7   8   9   10   >