Re: [Rd] Searching R Packages

2018-01-29 Thread Mark van der Loo
Dear Spencer,

Nice initiative!

I discover a lot of packages not by explicit search, but by running into
them. I find cranberries really helpful there, especially the twitter feed
(@CRANberries) and also r-bloggers, especially through Joseph Rickert's
monthly roundup of new packages. And then of course there is the R journal
and JSS, but those speak for themselves.

So maybe a 'keeping up to date' section would be nice in the article?

Best,
Mark





Op ma 29 jan. 2018 om 00:25 schreef Ravi Varadhan :

> Hi Spencer,
> Thank you for this wonderful service to the R community.
>
> A suggestion:  it would be great to discuss how to search github and
> Bioconductor repositories.
>
> Thanks,
> Ravi
>
> 
> From: R-devel  on behalf of Spencer Graves
> 
> Sent: Saturday, January 27, 2018 11:17 AM
> To: R-Devel
> Subject: [Rd] Searching R Packages
>
> Hello, All:
>
>
>   Might you have time to review the article I recently posted to
> Wikiversity on "Searching R Packages"
> (https://en.wikiversity.org/wiki/Searching_R_Packages)?
>
>
>   Please edit this yourself or propose changes in the associated
> "Discuss" page or in an email to this list or to me.
>
>
>   My goal in this is to invite readers to turn that article into a
> proposal for improving the search capabilities in R that would
> ultimately be funded by, e.g., The R Foundation.
>
>
>   What do you think?
>
>
>   Please forward this to anyone you think might be interested.
>
>
>   Thanks for your contributions to improving the lot of humanity
> through better statistical software.
>
>
>Best Wishes,
>Spencer Graves, PhD
>Founder
>EffectiveDefense.org
>7300 W. 107th St. # 506
>Overland Park, KS 66212
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Searching R Packages

2018-01-29 Thread Dirk Eddelbuettel

On 29 January 2018 at 11:02, Mark van der Loo wrote:
| I discover a lot of packages not by explicit search, but by running into
| them. I find cranberries really helpful there, especially the twitter feed
| (@CRANberries) and also r-bloggers, especially through Joseph Rickert's
| monthly roundup of new packages. And then of course there is the R journal
| and JSS, but those speak for themselves.
| 
| So maybe a 'keeping up to date' section would be nice in the article?

Yes.  But it is @CRANberriesFeed --- the handle for @cranberries was already
taken by either fans of the Irish band, or the fruit ...

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] bug [methods]: double execution of `insertSource` within the same session does not work

2018-01-29 Thread Demetrio Rodriguez T.
Hello everyone,


I hope this reaches someone at all. It's my first bug report to the R-core,
and, apparently, bugzilla is locked from new reports for now.

I was using `methods::insertSource` to debug and successfully fix another
package, until it suddenly stopped working. I figured out, that it is
because I am using it on the same function multiple times within one
session. It also produces warnings even during the first call, but somehow
still works. Below I provide a reproducible example:

SETUP:
```bash
demetrio@laptop:[folder_structure]/Bugreports/methods_insertSource$ ls -a
.  ..  gmapsdistance_fix.R  methods_insertSource.R
```

file `gmapsdistance_fix.R`
```R
gmapsdistance = function(param) {
print('I am a bug report, my params are:')
print(param)
}
```


file `methods_insertSource.R`
```R
library(gmapsdistance)  # works with any package

methods::insertSource('gmapsdistance_fix.R',
package = 'gmapsdistance',
functions = 'gmapsdistance',
force = T
)
buggy = gmapsdistance('Works?')
```


TO REPRODUCE:
in that directory `R --vanilla` then
```R
> source('methods_insertSource.R')
Modified functions inserted through trace(): gmapsdistance
[1] "I am a bug report, my params are:"
[1] "Works?"
Warning message:
In methods::insertSource("gmapsdistance_fix.R", package = "gmapsdistance",
:
  cannot insert these (not found in source): "gmapsdistance"
# Works, but gives the warning that it does not

# repeat:
> source('methods_insertSource.R')
Error in assign(this, thisObj, envir = envwhere) :
  cannot change value of locked binding for 'gmapsdistance'
In addition: Warning message:
In methods::insertSource("gmapsdistance_fix.R", package = "gmapsdistance",
:
  cannot insert these (not found in source): "gmapsdistance"

# does not work, and gets even more confusing: so is it that the object is
not find, or is it about a locked object?
```

I think it's a bug.

- BUG REPORT END 


I looked into it a bit myself, in case you are interested:

```R
# lines 20-22
if (is(source, "environment"))
env <- source
else env <- evalSource(source, package, FALSE)
# We're in the second case I guess

# Browse[2]> env
# Object of class "sourceEnvironment"
# Source environment created  2017-12-01 05:19:51
# For package "gmapsdistance"
# From source file "gmapsdistancefix.R"


# later, before line 52:
x = env
Browse[2]> package
[1] "gmapsdistance"

# evaluate 52
packageSlot(env) <- package

# objects x and env are still identical
# Browse[2]> class(env)
# [1] "sourceEnvironment"
# attr(,"package")
# [1] "methods"
# Browse[2]> class(x)
# [1] "sourceEnvironment"
# attr(,"package")
# [1] "methods"

# Browse[2]> env
# Object of class "sourceEnvironment"
# Source environment created  2017-12-01 05:19:51
# For package "gmapsdistance"
# From source file "gmapsdistancefix.R"
# Browse[2]> x
# Object of class "sourceEnvironment"
# Source environment created  2017-12-01 05:19:51
# For package "gmapsdistance"
# From source file "gmapsdistancefix.R"

# so:
Browse[2]>  names(env)
NULL

# which is why 53-60 do not work:
allObjects <- names(env)
if (!missing(functions)) {
notThere <- is.na(match(functions, allObjects))
if (any(notThere)) {
warning(gettextf("cannot insert these (not found in source): %s",
paste("\"", functions[notThere], "\"", sep = "",
collapse = ", ")), domain = NA)
}
}
```

Looking forward to your feedback!

Cheers,
Demetrio

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] bug [methods]: double execution of `insertSource` within the same session does not work

2018-01-29 Thread Michael Lawrence
Thanks, I will fix this.

On Mon, Jan 29, 2018 at 8:06 AM, Demetrio Rodriguez T. <
demetrio.rodrigue...@gmail.com> wrote:

> Hello everyone,
>
>
> I hope this reaches someone at all. It's my first bug report to the R-core,
> and, apparently, bugzilla is locked from new reports for now.
>
> I was using `methods::insertSource` to debug and successfully fix another
> package, until it suddenly stopped working. I figured out, that it is
> because I am using it on the same function multiple times within one
> session. It also produces warnings even during the first call, but somehow
> still works. Below I provide a reproducible example:
>
> SETUP:
> ```bash
> demetrio@laptop:[folder_structure]/Bugreports/methods_insertSource$ ls -a
> .  ..  gmapsdistance_fix.R  methods_insertSource.R
> ```
>
> file `gmapsdistance_fix.R`
> ```R
> gmapsdistance = function(param) {
> print('I am a bug report, my params are:')
> print(param)
> }
> ```
>
>
> file `methods_insertSource.R`
> ```R
> library(gmapsdistance)  # works with any package
>
> methods::insertSource('gmapsdistance_fix.R',
> package = 'gmapsdistance',
> functions = 'gmapsdistance',
> force = T
> )
> buggy = gmapsdistance('Works?')
> ```
>
>
> TO REPRODUCE:
> in that directory `R --vanilla` then
> ```R
> > source('methods_insertSource.R')
> Modified functions inserted through trace(): gmapsdistance
> [1] "I am a bug report, my params are:"
> [1] "Works?"
> Warning message:
> In methods::insertSource("gmapsdistance_fix.R", package = "gmapsdistance",
> :
>   cannot insert these (not found in source): "gmapsdistance"
> # Works, but gives the warning that it does not
>
> # repeat:
> > source('methods_insertSource.R')
> Error in assign(this, thisObj, envir = envwhere) :
>   cannot change value of locked binding for 'gmapsdistance'
> In addition: Warning message:
> In methods::insertSource("gmapsdistance_fix.R", package = "gmapsdistance",
> :
>   cannot insert these (not found in source): "gmapsdistance"
>
> # does not work, and gets even more confusing: so is it that the object is
> not find, or is it about a locked object?
> ```
>
> I think it's a bug.
>
> - BUG REPORT END 
>
>
> I looked into it a bit myself, in case you are interested:
>
> ```R
> # lines 20-22
> if (is(source, "environment"))
> env <- source
> else env <- evalSource(source, package, FALSE)
> # We're in the second case I guess
>
> # Browse[2]> env
> # Object of class "sourceEnvironment"
> # Source environment created  2017-12-01 05:19:51
> # For package "gmapsdistance"
> # From source file "gmapsdistancefix.R"
>
>
> # later, before line 52:
> x = env
> Browse[2]> package
> [1] "gmapsdistance"
>
> # evaluate 52
> packageSlot(env) <- package
>
> # objects x and env are still identical
> # Browse[2]> class(env)
> # [1] "sourceEnvironment"
> # attr(,"package")
> # [1] "methods"
> # Browse[2]> class(x)
> # [1] "sourceEnvironment"
> # attr(,"package")
> # [1] "methods"
>
> # Browse[2]> env
> # Object of class "sourceEnvironment"
> # Source environment created  2017-12-01 05:19:51
> # For package "gmapsdistance"
> # From source file "gmapsdistancefix.R"
> # Browse[2]> x
> # Object of class "sourceEnvironment"
> # Source environment created  2017-12-01 05:19:51
> # For package "gmapsdistance"
> # From source file "gmapsdistancefix.R"
>
> # so:
> Browse[2]>  names(env)
> NULL
>
> # which is why 53-60 do not work:
> allObjects <- names(env)
> if (!missing(functions)) {
> notThere <- is.na(match(functions, allObjects))
> if (any(notThere)) {
> warning(gettextf("cannot insert these (not found in source): %s",
> paste("\"", functions[notThere], "\"", sep = "",
> collapse = ", ")), domain = NA)
> }
> }
> ```
>
> Looking forward to your feedback!
>
> Cheers,
> Demetrio
>
> [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] help(pac=xxx) get data from CRAN?

2018-01-29 Thread Spencer Graves

Hello, All:


  A feature request:


  What about modifying the code for "help(pac=xxx)" so it looks for 
"xxx" on CRAN as well as locally:  If it finds it locally, it uses that 
version but with an annotation reporting what it found on CRAN:


* If it doesn't find CRAN, it doesn't report anything on this.
* If it finds CRAN, and the version numbers match, it reports that.
* If it finds CRAN, and the local version is behind CRAN, it says, 
"newer version on CRAN".
* If it finds CRAN, and the local version is ahead of CRAN, it says 
something like, "Local newer than CRAN."



  This occurred to me, because someone suggested I update the "sos" 
package to use CRAN to get package information for packages not already 
installed.  It's a great idea, but I'm not ready to do that just yet.



  Best Wishes,
  Spencer Graves

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] as.list method for by Objects

2018-01-29 Thread Dario Strbenac
Good day,

I'd like to suggest the addition of an as.list method for a by object that 
actually returns a list of class "list". This would make it safer to do 
type-checking, because is.list also returns TRUE for a data.frame variable and 
using class(result) == "list" is an alternative that only returns TRUE for 
lists. It's also confusing initially that

> class(x)
[1] "by"
> is.list(x)
[1] TRUE

since there's no explicit class definition for "by" and no mention if it has 
any superclasses.

--
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel