[R] Problems with external library conflict in R package

2019-10-31 Thread Pascal A. Niklaus
I have an R library (using Rcpp) that used to compile and install fine. It uses some boost libraries. My Makevars file looks like this: PKG_LIBS=`$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` -lboost_iostreams -lm CXX_STD = CXX14 The problem I face now is that for some other R-independent softwa

Re: [R] Global counter in library

2019-03-12 Thread Pascal A. Niklaus
Thanks for the hint. I think I will use a big.matrix [with 1 element only ;-) ] and a mutex to ensure access is thread-safe. Pascal On 12.03.19 17:35, Duncan Murdoch wrote: On 11/03/2019 2:57 p.m., Pascal A. Niklaus wrote: I am trying to implement a global counter in a library. This counter

[R] Global counter in library

2019-03-12 Thread Pascal A. Niklaus
I am trying to implement a global counter in a library. This counter resides in an environment local to that package, and is incremented by calling a function within this package. Problems arise when I use parallelization. I protected the increment operation with a lock so that this operation

Re: [R] data.table: reference column in "i"-part by column name in string object

2019-02-21 Thread Pascal A. Niklaus
On 21.02.19 20:43, Rui Barradas wrote: Hello, I don't understand the question. Like this? xx <- "B" yy <- "D" a[xx, on = v] a[c(xx, yy), on = v] Note that .(xx, yy) doesn't work. It outputs something else. Could you give an example of more complicated expressions you have doubts with? Let'

[R] data.table: reference column in "i"-part by column name in string object

2019-02-21 Thread Pascal A. Niklaus
I am converting data.frame-based code to data.table, for performance reasons. Is there a way to refer to columns using expressions in the "i"-part? Here is an example: a <- data.table(x=rep(LETTERS[1:10],each=2), y=1:20) v <- "x" For the j-part, I can access the column whose name is stored in

[R] Spacing around \cdot (%.%) unequal in pdf

2019-02-07 Thread Pascal A. Niklaus
I am struggling labeling an axis in a plot. Here is a minimal example illustrating the point: pdf("mve.pdf",width=5,height=5) ypos <- c(1:3) * 1e6 ylabs <- sapply(ypos/1e6, function(i) as.expression(bquote(.(i)%.%10^6))) plot(rep(1,3), ypos, yaxt="n", ylab="") axis(2, at=ypos, labels=ylabs, las

Re: [R] Sorting of character vectors

2016-11-08 Thread Pascal A. Niklaus
Thanks for all suggestions. With my build (from the CRAN repo) I don't get ICU support, and setting LC_COLLATE to "C" did not help. > capabilities("ICU") ICU FALSE > sessionInfo() R version 3.3.2 (2016-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.5 LTS locale:

[R] Sorting of character vectors

2016-11-08 Thread Pascal A. Niklaus
I just got caught by the way in character vectors are sorted. It seems that on my machine "sort" (and related functions like "order") only consider characters related to punctuation (at least here the "+" and "-") when there is no difference in the remaining characters: > x1 <- c("-A","+A") >

Re: [R] import of data set and warning from R CMD check

2016-06-23 Thread Pascal A. Niklaus
not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2016-06-17 17:45 GMT+02:00 Pascal A. Niklaus mailto:pascal.nikl...@ieu.uzh.ch>>: Hi all, When checking an R package, I get: |Consider adding importFrom("datasets","CO2")

[R] import of data set and warning from R CMD check

2016-06-17 Thread Pascal A. Niklaus
xported by 'namespace:datasets'| || |I understand that datasets are not exported, and the comment printed by 'R CMD check' seems not to have any consequences, but it nevertheless seems inconsistent to me. But maybe I miss something here... Pascal | -- Dr. Pascal A. Niklaus De

[R] error in lmerTest after updating to R 3.3.0

2016-05-10 Thread Pascal A. Niklaus
Dear all, After updating to R 3.3.0 (inadvertently, via apt-get), I get an error when using lmerTest. Here is an example: library(lmerTest) library(MASS) data(oats) m <- lmer(Y ~ N*V + (1|B/V), data=oats) summary(m) summary from lme4 is returned some computational error has occurred in lmerTe

[R] Keep factor order in lmer

2016-02-03 Thread Pascal A. Niklaus
I would like to keep a specific order of fixed effects in a model passed to lmer. In particular, I would like to prevent that interactions are automatically moved after all main effects. In aov and lme, this is possible with terms(..., keep.order=TRUE). Unfortunately, I have not found a way to

[R] Rcpp module / class access -- answer

2015-03-03 Thread Pascal A. Niklaus
Hi all, I am trying to answer my own question (although it probably does not end up in the thread because I am not a subscribed and thus have to send a new mail). The way I finally got the code working was: In NAMESPACE, comment out the following lines # importFrom(Rcpp, loadModule) # imp

[R] Rcpp module / class access

2015-03-03 Thread Pascal A. Niklaus
Dear all, I am struggling accessing a class created in an Rcpp module. The structure of the package is essentially the one created using: Rcpp.package.skeleton(name="testPackage",module=TRUE) Now, after loadiong the package with library(testPackage), I can create instances of the "World" cla

[R] Coordinate or top left corner + offset

2015-02-09 Thread Pascal A. Niklaus
Dear all, I am struggling to add annotations to panels of a series of plots arranged on a page. Basically, I'd like to add letters enumerating the panels ("a","b","c",...), at a fixed distance from the top left corner of the plot's "box". I succeeded partly with "mtext" (see below), but th

[R] lme model specification problem (Error in MEEM...)

2012-01-06 Thread Pascal A. Niklaus
Dear all, In lme, models in which a factor is fully "contained" in another lead to an error. This is not the case when using lm/aov. I understand that these factors are aliased, but believe that such models make sense when the factors are fitted sequentially. For example, I sometimes fit a f

[R] nlrob problem

2011-12-19 Thread Pascal A. Niklaus
Dear all, I am not sure if this mail is for R-help or should be sent to R-devel instead, and therefore post to both. While using nlrob from package 'robustbase', I ran into the following problem: For psi-functions that can become zero (e.g. psi.bisquare), weights in the internal call to nl

[R] rpanel

2011-10-11 Thread Pascal A. Niklaus
initval="1",pos=list(row=0,column=0)) rp.textentry(panel,var=b,labels="Var. B", initval="1",pos= list(row=1,column=0)) Thanks for your help Pascal -- Pascal A. Niklaus Institute of Evolutionary Biology and Environmental Studies Unive

[R] modify "..." (optional args)

2011-10-07 Thread Pascal A. Niklaus
complicated if there is more than one such case to consider. Thanks Pascal -- Pascal A. Niklaus Institute of Evolutionary Biology and Environmental Studies University of Zurich Winterthurerstrasse 190 CH-8057 Zurich / Switzerland __ R-help@r-pr

[R] "undefined slot classes" in package code

2011-10-06 Thread Pascal A. Niklaus
uot;test", .NAMESPACE ) } .onAttach <- function(libname, pkgname) {} .onUnload <- function(libname, pkgname) {} NAMESPACE useDynLib(myRcppTest) exportPattern("^[[:alpha:]]+") import( Rcpp ) -- Pascal A. Niklaus Institute of Evolutionary Biology an

[R] Problem with "setMethod" in R package

2011-01-26 Thread Pascal A. Niklaus
Dear all, My apologies for re-posting this question, but I have not found any solution to my problem so far. I also think that my post may have been overseen due to the posting time and high traffic on this list. I experience a problem in implementing a S4 class in a package and would apprec

[R] setMethod call in package code using Rcpp

2011-01-23 Thread Pascal A. Niklaus
Dear all, I experience a problem in implementing a S4 class in a package and would appreciate your help in this matter. The class is implemented using Rcpp, which works well. I then extend the class with R functions, adding them as methods with a call to setMethod(...). When I do this outsid

Re: [R] NA and NaN question

2009-01-07 Thread Pascal A. Niklaus
Thanks, now I understand what's happening. Maybe a line explaining this could be added to the help text for mean? Pascal Niklaus On Wed 07-Jan-2009 13:29:25 Prof Brian Ripley wrote: > Pascal A. Niklaus wrote: > > Hi all, > > > > I ran into a problem in some of my code

[R] NA and NaN question

2009-01-07 Thread Pascal A. Niklaus
Hi all, I ran into a problem in some of my code that could be traced back to 'mean' sometimes returning NA and sometimes NaN, depending on the value of na.rm: > mean(c()) [1] NA > mean(c(NA),na.rm=T) [1] NaN However, I don't understand the reasoning behind this and would appreciate and explan

[R] xyplot problem

2008-09-23 Thread Pascal A. Niklaus
Hi all, I am trying to produce some panels with dots in an X/Y plane where the diameter of the dots indicates a Z value (like e.g. earthquake maps where dot sizes indicate magnitudes and X/Y the location). This works fine with xyplot, e.g.: xyplot(1:3~1:3,cex=1:3,pch=16) However, when I do th