Re: [R-pkg-devel] Linker / System Requirement

2024-05-07 Thread Kevin Ushey
Hi Josiah, Indeed, the right thing to do is to declare the library in the SystemRequirements file. However, other than some specific documented usages which affect how R builds the package (e.g. C++ standards and GNU make), I believe the field is meant more just to inform users of the external

Re: [Rd] [External] Re: Is ALTREP "non-API"?

2024-04-25 Thread Kevin Ushey
On Thu, Apr 25, 2024 at 4:24 AM Ivan Krylov via R-devel wrote: > > On Wed, 24 Apr 2024 15:31:39 -0500 (CDT) > luke-tierney--- via R-devel wrote: > > > We would be better off (in my view, not necessarily shared by others > > in R-core) if we could get to a point where: > > > > all entry

Re: [R-pkg-devel] Order of repo access from options("repos")

2024-03-31 Thread Kevin Ushey
It may also be useful to use: options(internet.info = 1) to get more information on the web requests R is making. (See the documentation in ?options for more details.) Looking at the source code in available.packages, R does iterate through the repositories in the same order they're

Re: [R-pkg-devel] RFC: C backtraces for R CMD check via just-in-time debugging

2024-03-03 Thread Kevin Ushey
Would libSegFault be useful here? https://lemire.me/blog/2023/05/01/under-linux-libsegfault-and-addr2line-are-underrated/ On Sun, Mar 3, 2024, 5:15 PM Rolf Turner wrote: > On Sun, 3 Mar 2024 11:14:44 +0300 > Ivan Krylov via R-package-devel wrote: > > > Hello, > > > > This may be of interest to

Re: [R-pkg-devel] Unusually long execution time for R.utils::gzip on r-devel-windows

2024-02-17 Thread Kevin Ushey
FWIW, as far as I can tell, Sys.readlink() still doesn't handle symlinks (or junction points) on Windows. Were you thinking of normalizePath()? That does now resolve both symlinks and junction points on Windows (courtesy of a lot of work from Tomas), although I don't recall the exact versions in

Re: [Rd] [Feature Request] Hide API Key in download.file() / R's libcurl

2024-02-04 Thread Kevin Ushey
For cases like these, I think it would be more useful to have some mechanism for associating URLs / hosts with credentials, and have R use those credentials by default whenever accessing those URLs. Since download.file() now supports custom headers, this could be a mechanism for setting headers to

Re: [Rd] 答复: R-4.3 version list.files function could not work correctly in chinese

2023-08-14 Thread Kevin Ushey
Just to rule it out... is it possible that R is listing these files successfully, but is not printing the Chinese characters in those names for some reason? Using your example, what is the output of: f <- list.files(a, recursive = T) nchar(f) Does the reported number of characters match

Re: [R-pkg-devel] Feedback on "Using Rust in CRAN packages"

2023-07-12 Thread Kevin Ushey
Package authors could use 'cargo vendor' to include Rust crate sources directly in their source R packages. Would that be acceptable? Presumedly, the vendored sources would be built using the versions specified in an accompanying Cargo.lock as well.

Re: [Rd] Multiple Assignment built into the R Interpreter?

2023-03-11 Thread Kevin Ushey
FWIW, it's possible to get fairly close to your proposed semantics using the existing metaprogramming facilities in R. I put together a prototype package here to demonstrate: https://github.com/kevinushey/dotty The package exports an object called `.`, with a special `[<-.dot` S3 method

Re: [Rd] Unnecessary note when import only used in arg definition

2023-02-06 Thread Kevin Ushey
Hi Antoine, Maybe I'm misunderstanding, but I think the warning is saying that you've declared the package dependency in the DESCRIPTION file, but you haven't actually imported the package (or any functions) in your package NAMESPACE file? I put together an example package that I think satisfies

Re: [R-pkg-devel] problem with regdmp finding v4.2.x under Windows

2022-07-05 Thread Kevin Ushey
Hi Jonathan, I'm not certain if this is the issue you're encountering, but I've noticed that different versions of R may write to different locations in the registry. Right now, on my machine, I see entries for R 4.1.3 installed at: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\R-core\R

Re: [Rd] String interpolation [Was: string concatenation operator (revisited)]

2021-12-07 Thread Kevin Ushey
For what it's worth, you can also get 90% of the way there with: f <- glue::glue f("if you squint, this is a Python f-string") Having this in an add-on package also makes it much easier to change in response to user feedback; R packages have more freedom to make backwards-incompatible

Re: [R-pkg-devel] CRAN submission error when running tests in testthat

2021-11-25 Thread Kevin Ushey
That shouldn't be happening, at least not by default. However, RcppParallel does ship with tbbmalloc_proxy, which is a library that, when loaded, will overload the default allocators to use TBB's allocators instead. The intention is normally that these libraries would be loaded via e.g. LD_PRELOAD

Re: [Rd] Inconsistent is.list results on 'by' objects

2021-11-16 Thread Kevin Ushey
You can see this a bit more clearly with e.g. > storage.mode(byy) [1] "list" > storage.mode(byy.empty) [1] "logical" So even though both objects have S3 class "by", they have a different underlying internal storage mode (as simplifying the result of 'by' has given you a 0-length logical, instead

Re: [Rd] R-devel (r81196) hanging at dchisq(large) (PR#13309)

2021-11-16 Thread Kevin Ushey
Do you see this same hang in a build of R with debug symbols? Can you try running R with GDB, or even WinDbg or another debugger, to see what the call stack looks like when the hang occurs? Does the hang depend on the number of threads used by OpenBLAS? On the off chance it's relevant, I've seen

Re: [R-pkg-devel] windows and configure scripts

2021-08-07 Thread Kevin Ushey
On Fri, Aug 6, 2021 at 3:47 PM Tim Keitt wrote: > > As configure is not run on windows, but according to the writing extensions > docs you can run commands in Makevars, is that not preferable for simple > cases? IMHO it's ultimately up to you. Do what makes your life easier as a package

[Rd] small typo in internet.c

2021-06-12 Thread Kevin Ushey
Hello, I spotted a small typo recently in R-devel: $ rg "htto://" src/modules/internet/internet.c 95: warning(_("the 'wininet' method of url() is deprecated for htto:// and https:// URLs")); I suspect 'htto://' should read 'http://'. Thanks, Kevin

Re: [R-pkg-devel] Package not building for i386 after adding configure.win

2021-05-16 Thread Kevin Ushey
Based on this output: ** libs Warning: this package has a non-empty 'configure.win' file, so building only the main architecture Does adding Biarch: TRUE to your package DESCRIPTION file help? Best, Kevin On Sun, May 16, 2021 at 2:47 PM David Cortes wrote: > > I recently tried adding a

Re: [R-pkg-devel] compiling C sources on windows

2021-04-19 Thread Kevin Ushey
I suspect the cause is this: https://github.com/bradleyjeck/epanet2toolkit/blob/aa698568ab85db133f8634928e8cfe661b41ed57/src/epanet2.h#L42-L61 Usually, you only need to explicitly use __declspec if you're compiling with MSVC -- it shouldn't be necessary when using a MinGW toolchain (as R's

Re: [R-pkg-devel] Package gcc-ASAN issue

2021-04-16 Thread Kevin Ushey
>From https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-ASAN/rTLS/00check.log, you can see errors of the form: ==3566104==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7fffc2651f80 at pc 0x7f7ba5b635de bp 0x7fffc2651eb0 sp 0x7fffc2651ea0 < ... > The slides here explain what that

Re: [R-pkg-devel] Win-builder not finding binaries provided by LinkingTo: cargo?

2021-04-06 Thread Kevin Ushey
I think this is the pertinent error: > make: cargo: Command not found That is, make is assuming that the cargo utility is installed and available on the PATH, but that doesn't appear to be true on the CRAN winbuilder machine. The salso package (https://cran.r-project.org/package=salso)

Re: [Rd] Corrupt internal row names when creating a data.frame with `attributes<-`

2021-02-16 Thread Kevin Ushey
Strictly speaking, I don't think this is a "corrupt" representation, given that any APIs used to access that internal representation will call abs() on the row count encoded within. At least, as far as I can tell, there aren't any adverse downstream effects from having the row names attribute

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

2020-12-09 Thread Kevin Ushey
I agree with Duncan that the right solution is to wrap the pipe expression with parentheses. Having the parser treat newlines differently based on whether the session is interactive, or on what type of operator happens to follow a newline, feels like a pretty big can of worms. I think this (or

Re: [Rd] New pipe operator

2020-12-07 Thread Kevin Ushey
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 expensive than the alternatives. It is nice that the `|>`

Re: [R-pkg-devel] Rcpp with clang++ -stdlib=libc++ ?

2020-09-12 Thread Kevin Ushey
My understanding is that many Linux OSes package the clang compiler, the libc++ standard library, and the headers used by the libc++ standard library separately. To install those headers, you likely need (e.g. on Ubuntu): sudo apt install libc++-dev libc++abi-dev to be able to build and

Re: [Rd] `basename` and `dirname` change the encoding to "UTF-8"

2020-06-29 Thread Kevin Ushey
Did you test with R 4.0.2 or R-devel? A bug related to this issue was recently fixed: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17833 Best, Kevin On Mon, Jun 29, 2020 at 11:51 AM Duncan Murdoch wrote: > > On 29/06/2020 10:39 a.m., Johannes Rauh wrote: > > Dear R Developers, > > > > I

Re: [Rd] Possible Bug: file.exists() Function. Due to UTF-8 Encoding differences on Windows between R 4.0.1 and R 3.6.3?

2020-06-10 Thread Kevin Ushey
Hi Juan, For bug reports to R, you should attempt to create a minimally-reproducible example, using only R's builtin facilities and not any other addon packages. Given your report, it's not clear whether the issue lies within renv or truly is caused by a change in R 4.0.0. Also note that you

Re: [Rd] Rtools and R 4.0.0?

2020-04-07 Thread Kevin Ushey
That's great to see, although I suspect it's still a speculative change and could be backed out if any non-trivial issues were encountered. Regardless, I would like to thank R core, CRAN, and Jeroen for all of the time that has gone into creating and validating this new toolchain. This is arduous

[Rd] Rtools and R 4.0.0?

2020-04-01 Thread Kevin Ushey
Hello, Has a decision been made yet as to whether R 4.0.0 on Windows is going to be built using the new gcc8 toolchain (described at https://cran.r-project.org/bin/windows/testing/rtools40.html)? >From the sidelines, I can see that the toolchain is being used to build and test packages on CRAN;

Re: [R-pkg-devel] Problem with package using reticulate (and Config in DESCRIPTION)

2020-01-10 Thread Kevin Ushey
Note that by calling py_module_available() in your .onLoad(), as done here: https://github.com/r-cas/caracas/blob/418b3a552de0203c3d2f960f0e4235f7891db71d/R/init.R#L51 you are forcing reticulate to initialize the Python session eagerly when your package is loaded (so before the user might've had

Re: [R-pkg-devel] suggestion: conda for third-party software

2020-01-08 Thread Kevin Ushey
es/2 Best, Kevin On Wed, Jan 8, 2020 at 8:34 AM Kevin Ushey wrote: > > On Tue, Jan 7, 2020 at 10:42 PM Sokol Serguei wrote: > > > > Thanks for this hint. > > > > Le 07/01/2020 à 20:47, Kevin Ushey a écrit : > > > The newest version of reticulate does som

Re: [R-pkg-devel] suggestion: conda for third-party software

2020-01-08 Thread Kevin Ushey
On Tue, Jan 7, 2020 at 10:42 PM Sokol Serguei wrote: > > Thanks for this hint. > > Le 07/01/2020 à 20:47, Kevin Ushey a écrit : > > The newest version of reticulate does something very similar: R > > packages can declare their Python package dependencies in the >

Re: [R-pkg-devel] Set env variables for cmake

2019-11-08 Thread Kevin Ushey
It would help if you shared your source code, so we know what you've tried. Presumably, you need to either export the variables you're setting, or just pass them along when invoking CMake. For example: ENVVAR=1 export ENVVAR cmake <...> or ENVVAR=1 cmake <...> Best, Kevin On

Re: [Rd] [External] Re: should base R have a piping operator ?

2019-10-07 Thread Kevin Ushey
IMHO, if base R were to include a pipe operator, I think it should be much simpler than the magrittr pipe. It should satisfy the property that: x |> f(...) is equivalent to f(x, ...) Except, perhaps, in terms of when the promise for 'x' gets forced. We shouldn't need to mess with

Re: [Rd] ?Syntax wrong about `?`'s precedence ?

2019-08-30 Thread Kevin Ushey
See also: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16710 On Fri, Aug 30, 2019 at 9:02 AM William Dunlap via R-devel wrote: > > Precedence is a property of the parser and has nothing to do with the > semantics assigned to various symbols. Using just core R functions you can > see the

Re: [Rd] Possible bug in `class<-` when a class-specific '[[.' method is defined

2019-07-15 Thread Kevin Ushey
When RStudio builds the Environment pane, it will evaluate some R code on objects in your global environment (as you have seen). In particular, for better or worse, it calls `str()` on objects in the global environment, to get a short text summary of the object. So, to reproduce what you're

Re: [Rd] Fast way to call an R function from C++?

2019-06-18 Thread Kevin Ushey
Hi Jiefei, Calling into R from C++ code is more complicated than one might think. Please see Tomas Kalibera's post here: https://developer.r-project.org/Blog/public/2019/03/28/use-of-c---in-packages/index.html The Rcpp Function class is more expensive than a regular Rf_eval() because it tries to

Re: [Rd] Converting non-32-bit integers from python to R to use bit64: reticulate

2019-06-04 Thread Kevin Ushey
I think a more productive conversation could be: what additions to R would allow for user-defined types / classes that behave just like the built-in vector types? As a motivating example, one cannot currently use the 64bit integer objects from bit64 to subset data frames: > library(bit64);

Re: [Rd] SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()

2019-04-12 Thread Kevin Ushey
I think it's worth saying that mclapply() works as documented: it relies on forking, and so doesn't work well in environments where it's unsafe to fork. This is spelled out explicitly in the documentation of ?mclapply: It is strongly discouraged to use these functions in GUI or embedded

Re: [Rd] Use of C++ in Packages

2019-03-29 Thread Kevin Ushey
I think it's also worth saying that some of these issues affect C code as well; e.g. this is not safe: FILE* f = fopen(...); Rf_eval(...); fclose(f); whereas the C++ equivalent would likely handle closing of the file in the destructor. In other words, I think many users just may not

Re: [R-pkg-devel] Cran submission - warning with windows (cpp build library gmp)

2019-02-22 Thread Kevin Ushey
The 'long long' type does not exist in the C++98 standard, so you need to explicitly request C++11 or C++14 (the former which is now fairly broadly supported across compilers on different systems). For more detail, see in the R extensions manual:

Re: [Rd] Objectsize function visiting every element for alt-rep strings

2019-01-22 Thread Kevin Ushey
I think that object.size() is most commonly used to answer the question, "what R objects are consuming the most memory currently in my R session?" and for that reason I think returning the size of the internal representations of objects (for e.g. ALTREP objects; unevaluated promises) is the right

Re: [Rd] methods(class = class()) - improve for |cl.| > 1 ?

2018-10-19 Thread Kevin Ushey
I think this would be a good change. I think most users use the 'methods(class = <...>)' function to answer the question, "what methods can I call on objects with these classes?", and in that context I think it would be sensible for the function to accept more than one class. Kevin On Wed, Oct

Re: [Rd] Bug when calling system/system2 (and request for Bugzilla account)

2018-09-14 Thread Kevin Ushey
FWIW I can reproduce on macOS with R 3.5.1. A smaller example: system2("ls", timeout = 5); x <- sample(1:1E8) If I try to interrupt R while that sample call is running, R itself is closed. Best, Kevin On Fri, Sep 14, 2018 at 10:53 AM Emil Bode wrote: > > I hope it's not too specific in my

Re: [Rd] True length - length(unclass(x)) - without having to call unclass()?

2018-09-05 Thread Kevin Ushey
More generally, I think one of the issues is that R is not yet able to decrement a reference count (or mark a 'shared' data object as 'unshared' after it knows only one binding to it exists). This means passing variables to R closures will mark that object as shared: x <- list()

Re: [R-pkg-devel] Making adjustments to the R CMD check/install commands

2018-08-27 Thread Kevin Ushey
Hi Erin, The R extensions manual should be helpful here -- in particular, see the sections on the 'src/Makevars' file and configuration of the Fortran compiler: https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-Makevars In particular, in your 'src/Makevars' file, you'll likely

Re: [R-pkg-devel] R_registerRoutines, R_useDynamicSymbols

2018-08-13 Thread Kevin Ushey
Note that your attachment was lost, so we don't know what your package code looks like. It's helpful to host your package sources somewhere publicly accessible (e.g. GitHub) to make it easier for others to access sources quickly from a web browser. My best guess is that your 'init.c' is missing

Re: [Rd] Output mis-encoded on Windows w/ RGui 3.5.1 in strange case

2018-07-18 Thread Kevin Ushey
ote: > > Thanks, I can now reproduce and it is a bug that is easy to fix, I will do so > shortly. > > Fyi it can be reproduced simply by running these two lines in Rgui: > > list() > encodeString("apple") > > Best > Tomas > > On 07/17/2018 05:16

Re: [Rd] Output mis-encoded on Windows w/ RGui 3.5.1 in strange case

2018-07-17 Thread Kevin Ushey
ample if you believe it is a bug. Please also use current R-devel > (I've relatively recently fixed a bug in decoding these escaped strings, > perhaps unlikely, but not impossible it could be related). > > Best > Tomas > > On 07/16/2018 10:01 PM, Kevin Ushey wrote: > > Giv

[Rd] Output mis-encoded on Windows w/ RGui 3.5.1 in strange case

2018-07-16 Thread Kevin Ushey
Given the following R script: x <- 1 print(list()) save(x, file = tempfile()) output <- encodeString("apple") print(output) If I source this script from RGui on Windows, I see the output: > source("encoding.R") list() [1] "\002ÿþapple\003ÿþ" That is, it's as though R

Re: [R-pkg-devel] Help with reproducing (and solving) clang-UBSAN and Solaris installation errors

2018-07-10 Thread Kevin Ushey
The UBSAN error: cvode.cpp:58:11: runtime error: call to function cv_Roberts_dns(double, Rcpp::Vector<14, Rcpp::PreserveStorage>) through pointer to incorrect function type 'Rcpp::Vector<14, PreserveStorage> (*)(double, Rcpp::Vector<14, PreserveStorage>)'

Re: [Rd] writeLines argument useBytes = TRUE still making conversions

2018-02-17 Thread Kevin Ushey
Of course, right after writing this e-mail I tested on my Windows machine and did not see what I expected: > charToRaw(before) [1] c3 a9 > charToRaw(after) [1] e9 so obviously I'm misunderstanding something as well. Best, Kevin On Sat, Feb 17, 2018 at 2:19 PM, Kevin Ushey <kevinus...@

Re: [Rd] writeLines argument useBytes = TRUE still making conversions

2018-02-17 Thread Kevin Ushey
uot;UTF-8") cat(before, file = conn, sep = "\n") after <- readLines(conn) charToRaw(before) charToRaw(after) with output: > charToRaw(before) [1] c3 a9 > charToRaw(after) [1] c3 a9 Best, Kevin On Thu, Feb 15, 2018 at 9:16 AM, Ista Zahn <is

Re: [Rd] writeLines argument useBytes = TRUE still making conversions

2018-02-15 Thread Kevin Ushey
I suspect your UTF-8 string is being stripped of its encoding before write, and so assumed to be in the system native encoding, and then re-encoded as UTF-8 when written to the file. You can see something similar with: > tmp <- 'é' > tmp <- iconv(tmp, to = 'UTF-8') > Encoding(tmp) <-

Re: [R-pkg-devel] Solaris and ggplot2

2018-02-13 Thread Kevin Ushey
Hi, Glancing at the R CMD check errors, available at: https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/RJafroc-00install.html) It seems like the issues relate to ambiguous calls to 'sqrt()'. This particular issue is discussed in R-exts, at:

Re: [R-pkg-devel] CRAN and packages bundling third party C/C++ code

2018-01-23 Thread Kevin Ushey
uld handle these warnings emitted myself from TBB would still be appreciated (for myself and other package authors who might want to embed 3rd party code in their packages). Thanks, Kevin On Thu, Jan 18, 2018 at 11:19 AM, Kevin Ushey <kevinus...@gmail.com> wrote: > > Hi, > > This is mostly

[R-pkg-devel] CRAN and packages bundling third party C/C++ code

2018-01-18 Thread Kevin Ushey
Hi, This is mostly a question for the CRAN team, but I figured posting here would be best since other package maintainers could see the responses as well. I'm currently in the process of preparing a submission of RcppParallel to CRAN. RcppParallel bundles Intel's Threading Building Blocks

Re: [Rd] Bug: Issues on Windows with SFN disabled

2017-12-08 Thread Kevin Ushey
For what it's worth, the Windows installers for other programming language runtimes often install outside of Program Files, so at least there is 'prior art' to motivate having R install directly into the root of the home drive: - ActiveState Perl installs directly C:/Perl; - Python

Re: [R-pkg-devel] Warning of DDRTree

2017-04-13 Thread Kevin Ushey
You can try placing this in your src/Makevars[.win] file: CXXFLAGS = -DBOOST_NO_LONG_LONG The dplyr package does this (and more) to avoid 'long long' leaking in from Boost headers. See e.g. https://github.com/tidyverse/dplyr/blob/ff719f53f88f2f03a298fa0ea489b902527ee2f1/src/Makevars#L2 The

Re: [Bioc-devel] error from biocLite on OSX with R-devel / Bioc-devel

2017-02-01 Thread Kevin Ushey
Although installation succeeds for me (macOS Sierra with recent R-devel), I see the following output in an interactive session when I try to install the lazyeval package: > install.packages('lazyeval', repos = BiocInstaller:::biocinstallRepos()) Installing package into

Re: [R-pkg-devel] no visible global function definition for ‘par’

2017-01-30 Thread Kevin Ushey
Most importantly, this _is_ a recent-ish change in R CMD check. Previously, R CMD check did not warn about missing imports from 'base' R packages (that is, R packages distributed with R, having priority 'base'); now it correctly does. While packages with priority 'base' are loaded by default in

Re: [Rd] unlicense

2017-01-17 Thread Kevin Ushey
The Free Software Foundation maintains a list of free and GPL-compatible software licenses here: https://www.gnu.org/licenses/license-list.en.html#Unlicense It appears that Unlicense is considered a free and GPL-compatible license; however, the page does suggest using CC0 instead (which is

Re: [Rd] require(..., quietly=TRUE) does not suppress warning

2016-12-08 Thread Kevin Ushey
IMHO the strongest argument for suppressing the warning message here is the fact that requireNamespace("foo", quietly = TRUE) does not emit any warning message when the package 'foo' does not exist. On Thu, Dec 8, 2016 at 12:51 PM, Dan Tenenbaum wrote: > Well, I'm

Re: [Rd] creating a long list puts R in a state where many things stop working

2016-11-15 Thread Kevin Ushey
For reference, running your code in a build of R-devel with sanitizers: > x <- vector(mode="list", length=3e9) memory.c:2747:27: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'R_len_t' (aka 'int') SUMMARY: AddressSanitizer: undefined-behavior

[Bioc-devel] BiocInstaller fails to load with older R if messages suppressed

2016-10-31 Thread Kevin Ushey
(Sorry about cross-posting, but I didn't receive a response at https://support.bioconductor.org/p/88777/) --- BiocInstaller incorrectly detects https support if loaded within a 'suppressMessages()' context, and that failure leads to a namespace load failure on versions of R without libcurl

[Rd] improve 'package not installed' load errors?

2016-10-24 Thread Kevin Ushey
Hi R-devel, One of the more common issues that new R users see, and become stumped by, is error messages during package load of the form: > library(ggplot2) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called 'Rcpp' Error: package

Re: [R-pkg-devel] R package with external C++ library

2016-08-03 Thread Kevin Ushey
On Wed, Aug 3, 2016 at 3:09 PM, MTurgeon wrote: > Hi Ege, > > For writing to standard output/error, you can use Rcout or Rcerr (defined by > Rcpp; they even have a vignette showing how to use it in the Rcpp gallery). > Alternatively, if you're using C code, you can

Re: [R-pkg-devel] R package with external C++ library

2016-08-03 Thread Kevin Ushey
It looks like most of these usages of std::cout, std::cerr and abort are coming from the logging infrastructure: https://github.com/micolous/s2-geometry-library/blob/master/geometry/base/logging.h If you wanted to make this work on CRAN, you could patch these files in a number of ways: You

Re: [Rd] strange behavior in 'inherits' check for loaded S4 object

2016-08-02 Thread Kevin Ushey
d currently guess that it would be a >> good idea if .requirePackage() would always return the >> *namespace* of the corresponding package unless that does not >> yet exist, as in the the 'bootstrap' situations above. >> ... or we'd add a new argument to .requirePa

Re: [Rd] strange behavior in 'inherits' check for loaded S4 object

2016-07-29 Thread Kevin Ushey
: digest > methods:::.requirePackage("digest") > "digest" %in% loadedNamespaces() [1] TRUE > "package:digest" %in% search() [1] FALSE This may be intentional, but the behavior seems surprising and could be responsible for the behavio

Re: [Rd] strange behavior in 'inherits' check for loaded S4 object

2016-07-29 Thread Kevin Ushey
lookup fails. (Presumedly, that lookup is done when initially building a cache for S3 dispatch?) So, I wonder if that class lookup should occur within the package's namespace instead? Thanks for your time, Kevin On Sat, Jun 25, 2016 at 12:46 PM, Kevin Ushey <kevinus...@gmail.com> wrote: > H

Re: [R-pkg-devel] package build warning

2016-07-24 Thread Kevin Ushey
me conflict. For now, it is just a warning soI will keep > looking for the problem and if I can solve it post back here as it must be > quite subtle given all else is working fine. > > Glenn > > >> On Jul 24, 2016, at 3:27 PM, Kevin Ushey <kevinus...@gmail.com> wrot

Re: [R-pkg-devel] package build warning

2016-07-24 Thread Kevin Ushey
Did you call `devtools::document()` before building and checking your package? Everything looks fine to me with your test example. You should also double-check that you have up-to-date versions of the devtools and roxygen2 packages. It's also worth knowing that nowadays you can generally just use

Re: [Rd] package installation fails when symlink of same name exists

2016-07-20 Thread Kevin Ushey
On Wed, Jul 20, 2016 at 3:52 AM, Martin Maechler <maech...@stat.math.ethz.ch> wrote: >>>>>> Jeroen Ooms <jeroeno...@gmail.com> >>>>>> on Wed, 20 Jul 2016 10:26:19 +0200 writes: > > > On Tue, Jul 19, 2016 at 6:46 PM, Kevin Ushey <

[Rd] package installation fails when symlink of same name exists

2016-07-19 Thread Kevin Ushey
R fails to install a package from source over a pre-existing package when the path to that package is a symlink, rather than a directory. A reproducible example to illustrate (using MASS as an example): # create a temporary R library in tempdir library <- tempfile() if

[Rd] strange behavior in 'inherits' check for loaded S4 object

2016-06-25 Thread Kevin Ushey
Hi, (sorry for the wall of text; the issue here appears to be rather complicated) I'm seeing a somewhat strange case where checking whether an S4 object inherits from a parent class defined from another package with 'inherits' fails if that object is materialized through a call to 'load'. That's

Re: [R-pkg-devel] What to do when you can't reproduce CRAN R CMD check unit test failures?

2016-05-12 Thread Kevin Ushey
Is it possible that `getwd()` is reporting something on the CRAN build servers that your `decompose_path()` doesn't handle? For example, your tests fail for me if I run them while in the root directory (on OS X). Kevin On Thu, May 12, 2016 at 12:37 AM, Richard Cotton

Re: [R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

2015-09-01 Thread Kevin Ushey
FWIW, it's a very _very_ bad idea to add methods to S3 generics for classes you don't 'own'. Some code might be written with the expectation that `plot(df)` actually does dispatch to `plot.default`. This implies that simply loading your package would break code in surprising ways. I would

Re: [Rd] Issues with libcurl + HTTP status codes (eg. 403, 404)

2015-08-27 Thread Kevin Ushey
Thanks for looking into this so promptly! Should users expect the behaviour to be congruent across all of the supported external programs (curl, wget) as well? E.g. URL - http://cran.rstudio.org/no/such/file/here.tar.gz; download - function(file, method, ...)

Re: [Rd] Issues with libcurl + HTTP status codes (eg. 403, 404)

2015-08-25 Thread Kevin Ushey
Hi Martin, Indeed it does (and I should have confirmed myself with R-patched and R-devel before posting...) Thanks, and sorry for the noise. Kevin On Tue, Aug 25, 2015, 13:11 Martin Morgan mtmor...@fredhutch.org wrote: On 08/25/2015 12:54 PM, Kevin Ushey wrote: Hi all, The following

[Rd] Issues with libcurl + HTTP status codes (eg. 403, 404)

2015-08-25 Thread Kevin Ushey
Hi all, The following fails for me (on OS X, although I imagine it's the same on other platforms using libcurl): options(download.file.method = libcurl) options(repos = c(CRAN = https://cran.rstudio.com/;, CRANextra = http://www.stats.ox.ac.uk/pub/RWin;)) install.packages(lattice) ##

Re: [Rd] Issues with libcurl + HTTP status codes (eg. 403, 404)

2015-08-25 Thread Kevin Ushey
that R-core is aware of. Thanks, and apologies again for the spam, Kevin On Tue, Aug 25, 2015 at 2:41 PM, Kevin Ushey kevinus...@gmail.com wrote: In fact, this does reproduce on R-devel: options(download.file.method = libcurl) options(repos = c(CRAN = https://cran.rstudio.com

Re: [Rd] R package with Fortran module on Windows? undefined reference to `__stack_chk_fail'

2015-07-27 Thread Kevin Ushey
You should be able to set PKG_FCFLAGS=-fno-stack-protector when compiling to ensure that the stack protector is not used. (Trying that out on a Windows VM, with a simple `R CMD build` + `R CMD INSTALL`, compilation of your package succeeded but linking failed saying the DLL 'Fpi' was not found; I

Re: [Rd] bquote/evalq behavior changed in R-3.2.1

2015-07-15 Thread Kevin Ushey
My best guess is that it could be related to this commit: https://github.com/wch/r-source/commit/14f904c32a44010d4dfb8a829805648a88c22f53, since that's the only change that's touched `rapply` lately. On Wed, Jul 15, 2015 at 12:35 PM, Dayne Filer dayne.fi...@gmail.com wrote: In 3.1.2 eval does

Re: [R-pkg-devel] no visible global function definition

2015-06-29 Thread Kevin Ushey
Hi Uwe, It seems like this is quite a major change; I imagine it will affect many packages (since lots of packages implicitly assume other 'base' packages, like 'utils', will always be available in an R session). IIUC, in the latest versions of R-devel, only the 'base' package can be assumed

Re: [Rd] NEWS.md support on CRAN

2015-05-24 Thread Kevin Ushey
I like the idea of supporting a small, strict subset of Markdown that can be used to translate from NEWS.md to NEWS. Following from Yihui's example, it would be pretty easy to write a parser in R for such a format (and I'd be willing to try implementing one, if that would be of interest). Kevin

Re: [Rd] Installation error with R-devel

2015-05-15 Thread Kevin Ushey
It's hard to diagnose this without your package sources / a reproducible example. Shot in the dark: one thing worth checking is that you don't have an entry in your `.Rbuildignore` that's removing files you don't expect it to (maybe that's causing R to strip out the 'doc/index.html' file) Kevin

Re: [Rd] Reading exit code of pipe()

2015-05-13 Thread Kevin Ushey
Hi Jeroen, I think `pipe` might just be returning the status code of the underlying command executed; for example, I get a status code of '0' when I test a pipe on `ls`: conn - pipe(ls) stream - readLines(conn) print(close(conn)) Similarly, I get an error code if I try to `ls` a

Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Kevin Ushey
One other solution that's only a little crazy: you could have a R function within your package that generates the appropriate (portable) Makevars, and within the package `configure` script call that function. For example R --vanilla --slave -e source('R/makevars.R'); makevars() And that

Re: [Rd] Inconsistency when naming a vector

2015-04-27 Thread Kevin Ushey
In `?names`: If ‘value’ is shorter than ‘x’, it is extended by character ‘NA’s to the length of ‘x’. So it is as documented. That said, it's somewhat surprising that both NA and serve as a placeholder for a 'missing name'; I believe they're treated identically by R under the hood

Re: [Bioc-devel] portable make syntax

2015-01-23 Thread Kevin Ushey
On Fri, Jan 23, 2015 at 5:18 PM, Dan Tenenbaum dtene...@fredhutch.org wrote: - Original Message - From: Kevin Ushey kevinus...@gmail.com To: Laurent Gatto lg...@cam.ac.uk Cc: bioc-devel bioc-de...@stat.math.ethz.ch Sent: Friday, January 23, 2015 4:58:40 PM Subject: Re: [Bioc-devel

Re: [Rd] subscripting a data.frame (without changing row order) changes internal row.names

2014-11-10 Thread Kevin Ushey
I believe the question here is related to the sign on the compact row names representation: why is it sometimes `c(NA, positive)` and sometimes `c(NA, negative)` -- why the difference in sign? To the best of my knowledge, older versions of R used the signed-ness of compact row.names to

[Rd] R's internal tar ignores files in sub-directories

2014-09-30 Thread Kevin Ushey
E.g. I am seeing: dir - file.path(tempdir(), test-tar) dir.create(dir) setwd(dir) dir.create(foo, showWarnings = FALSE) file.create(foo/bar.R) tar(test.tar, files = foo/bar.R) dir.create(untarred) untar(test.tar, exdir = untarred) list.files(untarred,

[Rd] Bug in new behaviour for all.equal and environments?

2014-09-21 Thread Kevin Ushey
Hi R-devel, The following code: all.equal(baseenv(), baseenv()) gives the error when run in a clean R session with latest R-devel (r66650): kevin:~$ R --vanilla --slave -e all.equal(baseenv(), baseenv()) Error in all.equal.envRefClass(target[[i]], current[[i]], check.attributes =

Re: [Rd] vignette index going AWOL

2014-08-25 Thread Kevin Ushey
Hi Randall, I notice that, in your .Rbuildignore, you have the entry: ^build$ and I suspect this is the culprit (having being bitten by a similar problem before). Some part of the R build / install process creates / uses that directory, but having it excluded in .Rbuildignore will cause you

[Rd] Removed 'extern' on R_running_as_main_program in Rinterface.h -- intentional?

2014-07-22 Thread Kevin Ushey
Hi R-devel, In this commit: https://github.com/wch/r-source/commit/c67a107dd7b0f074cec9359b8e2ca07c6243283c R_running_as_main_program was moved from Rmain.c to Rinterface.h, and lost its 'extern' declaration. This change is causing us linker problems (since we now have duplicate symbols for

[Rd] USE_CXX1X, Snow Leopard R binaries + Mavericks

2014-07-01 Thread Kevin Ushey
Hi R-devel, I'm noticing the following behaviour: writeLines(#include Rcpp.h, file = test.cpp) Rcpp::sourceCpp(~/test.cpp) ## succeeds at trivial compile Sys.setenv(USE_CXX1X = yes) Rcpp::sourceCpp(~/test.cpp) ## fails; CXX nor CXX1X properly set (?) IIUC, R is not propagating

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-25 Thread Kevin Ushey
, so let's all just agree that, regardless of what the correct interpretation is, 'i = i++' and 'i = ++i' are just things you shouldn't write :) Cheers, Kevin On Tue, Jun 24, 2014 at 3:38 PM, Hervé Pagès hpa...@fhcrc.org wrote: Hi Kevin, On 06/23/2014 10:28 PM, Kevin Ushey wrote: I don't

Re: [Rd] operation on ‘numsels’ may be undefined

2014-06-23 Thread Kevin Ushey
I don't see what's so surprising here. That statement is identical to writing: if (arrMask[i] == 1) { numsels = ++numsels; } else { numsels = numsels; } and numsels = ++numsels; has two statements modifying the value of numsels (= and prefix-++) in a single

Re: [Rd] How to test if an object/argument is parse tree - without evaluating it?

2014-05-01 Thread Kevin Ushey
Henrik, If I understand correctly, you want something along the lines of (following your example): foo - function(expr) { if (!is.language(expr)) substitute(expr) else expr } ## first example expr0 - foo({ x - 1 }) expr1 - foo(expr0)

  1   2   >