Re: [Rd] Clash between 'Cairo' and 'EBImage' packages on Windows
On Mon, 21 Jul 2008, Simon Urbanek wrote: Brian, thanks for the analysis. On Jul 21, 2008, at 6:29 , Prof Brian Ripley wrote: On Mon, 21 Jul 2008, Sklyar, Oleg (London) wrote: EBImage is dynamically linked against GTK, which includes cairo libraries, so those are installed along with GTK. Cairo seems to be statically linking to libcairo.dll.a. I would assume that if it is That is an import library, so it is actually linked to libcairo-2.dll, which it ships. linked statically it should not get confused with a shared library present elsewhere in the path, but it looks like it does. I have no solution for that because unlike Cairo I cannot not statically link EBImage to GTK as it is not one library that I need, but a bunch of those. On Linux you won't get this problem as it uses the same centrally installed Cairo library. In a way it would be better, if Cairo relied on the gladewin32.sf.net which normally provides GTK (and thus cairo libraries) for Windows and linked dynamically, but probably to simplify user installations the developers wanted to avoid this. It _is_ using dynamic loading, or there would be no conflict. From the names, it looks very like that it is using a DLL from gladewin32. The real issue looks rather like a versioning problem, that the cairo libraries installed as part of GTK and used by EBImage are way too old (cairo_pdf_surface_create was added at cairo 1.2, and cairo is at 1.6.4). So updating to the current GTK distribution may be all that is needed (and Henrik could also try replacing your GTK's libcairo-2.dll by that distributed with Cairo). For compatibility sake I have updated the libcairo binary to 1.6.4 (based on GTK+ build), so if EBImage gets updated all should be well. EBImage relies on a user installation of GTK (AFAICS). Last night I updated my GTK to 2.12.9 and used that's libcairo-2.dll in Cairo. It all seemed to work. There is not much I can do now about this, but I will follow the thread if anybody comes up with an idea to change the code if possible The Cairo package (which ships DLLs) could rename them, as R itself does where it builds its own versions. Or it could link statically (if that works, which it does not for e.g. package XML). I'd rather not maintain my own build of libcairo for Windows since I don't use it. I may consider renaming the DLL, but given that I'm not building it from sources I'm not sure whether there is a trivial way to do that. If you are not building it yourself, then the only way is to use an editor on the DLL to change the embedded name. I wouldn't suggest you do that (I had thought you were building it yourself). Best, Simon I don't really understand why this was posted to R-devel: it is not an R issue. Dr Oleg Sklyar Technology Group Man Investments Ltd +44 (0)20 7144 3803 [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Henrik Bengtsson Sent: 19 July 2008 19:26 To: R-devel Subject: [Rd] Clash between 'Cairo' and 'EBImage' packages on Windows Hi, on Windows XP Pro with R version 2.7.1 Patched (2008-06-27 r46012) the 'Cairo' and the 'EBImage' packages does not play well together. Loading EBImage before Cairo cause the following to happen: # Rterm --vanilla library(EBImage); library(Cairo) Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/PROGRA~1/R/R-2.7.1pat/library/Cairo/libs/Cai ro.dll': LoadLibrary failure: The specified procedure could not be found. Error : .onLoad failed in 'loadNamespace' for 'Cairo' Error: package/namespace load failed for 'Cairo' with a dialog titled 'Rterm.exe - Entry Point Not Found' saying 'The procedure entry point cairo_pdf_surface_create could not be located in the dynamic link library libcairo-2.dll'. Loading the packages in the reverse order works, but the Rterm seems unstable, e.g. calling q() immediately after will exit the R session without questions: # Rterm --vanilla library(Cairo) library(EBImage) q() [Immediately back to the command line]. I cannot reproduce the problem on R v2.7.1 on Ubuntu Hardy. sessionInfo() R version 2.7.1 Patched (2008-06-27 r46012) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MON ETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] EBImage_2.4.0 Cairo_1.4-2 Cheers Henrik __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel ** The contents of this email are for the named addressee(s...{{dropped:22}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Brian D.
[Rd] Parameter names in nls()
Dear R-dev, I have been having some problems with regards to names in the parameter vector being stripped when passed to the objective function when using nls(). I was relieved to find that it wasn't me, and that this behaviour has previously been reported in optim() also. See eg https://stat.ethz.ch/pipermail/r-devel/2006-March/036710.html The solution at that time was to make a change so that vector passed into the objective function was named (eg see following two discussions). The problem that I am having is virtually identical, but is occuring with nls() instead of optim(). To illustrate the problem, I have put together the following example code (see bottom). Basically, it is doing a linear least squares by hand, but it also displays the names associated on the parameters vector - if you run it, you will see that the names are there for the first few function evaluations, but after the first "step", the names are dropped. I was wondering if I could please ask for a similar fix as that applied to optim() to be carried across to nls() also? Many thanks, Mark #Setup environment rm(list=ls()) counter <- 1 #Objective function for nls fitting.fn <-function(x,params) { #The model - so that it works y <- params[1] + x*params[2] #Referring to the parameters this way stops working after the first "step" # y <- params["a"] + x*params["b"] #Display information about function eval and parameter names cat(paste("Evaluation # :",counter,"\t Names :")) print(names(params)) counter <<- counter +1 return(y) } #Synthetic data data.x <- 1:50 data.y <- pi*data.x + rnorm(50,sd=20) #Fit objective function ips <- c(a=0,b=0) nls("data.y~fitting.fn(data.x,params)",data=data.frame(data.x,data.y), start=list(params=ips),trace=TRUE,control=nls.control(tol=1e-8)) [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Parameter names in nls()
They are not 'stripped': nothing says that because you named the starting value that other values will be named. You are misusing nls(): the documented way would be to have data.x <- 1:50 data.y <- pi*data.x + rnorm(50,sd=20) fitting.fn <-function(x, a, b) a + b*x nls(data.y ~ fitting.fn(data.x, a, b),data=data.frame(data.x,data.y), start=list(a=0, b=0),trace=TRUE,control=nls.control(tol=1e-8)) On Tue, 22 Jul 2008, Mark Payne wrote: Dear R-dev, I have been having some problems with regards to names in the parameter vector being stripped when passed to the objective function when using nls(). I was relieved to find that it wasn't me, and that this behaviour has previously been reported in optim() also. See eg https://stat.ethz.ch/pipermail/r-devel/2006-March/036710.html Note that you are quoting a comment about a different function in a long obsolete version of R, with a very different interface. That's called 'clutching at straws'. The solution at that time was to make a change so that vector passed into the objective function was named (eg see following two discussions). The problem that I am having is virtually identical, but is occuring with nls() instead of optim(). To illustrate the problem, I have put together the following example code (see bottom). Basically, it is doing a linear least squares by hand, but it also displays the names associated on the parameters vector - if you run it, you will see that the names are there for the first few function evaluations, but after the first "step", the names are dropped. I was wondering if I could please ask for a similar fix as that applied to optim() to be carried across to nls() also? Many thanks, Mark #Setup environment rm(list=ls()) counter <- 1 #Objective function for nls fitting.fn <-function(x,params) { #The model - so that it works y <- params[1] + x*params[2] #Referring to the parameters this way stops working after the first "step" # y <- params["a"] + x*params["b"] #Display information about function eval and parameter names cat(paste("Evaluation # :",counter,"\t Names :")) print(names(params)) counter <<- counter +1 return(y) } #Synthetic data data.x <- 1:50 data.y <- pi*data.x + rnorm(50,sd=20) #Fit objective function ips <- c(a=0,b=0) nls("data.y~fitting.fn(data.x,params)",data=data.frame(data.x,data.y), start=list(params=ips),trace=TRUE,control=nls.control(tol=1e-8)) [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] Is text(..., adj) upside down? (Or am I?)
?text says "'adj' allows _adj_ustment of the text with respect to '(x,y)'. Values of 0, 0.5, and 1 specify left/bottom, middle and right/top, respectively." But it looks like 0, 1 specify top, bottom respectively in the y direction. plot(1:4) text(2,2, "adj=c(0,0)", adj=c(0,0)) text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the black one... #x-adj is OK text(3,3, "adj=c(0,0)", adj=c(0,0)) text(3,3, "adj=c(1,0)", adj=c(1,0), col=2) [I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff and for expressions as well as text] Perhaps a two-word correction to ?text ? Steve Ellison Lab of the Government Chemist UK *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Is text(..., adj) upside down? (Or am I?)
On 7/22/2008 7:36 AM, S Ellison wrote: ?text says "'adj' allows _adj_ustment of the text with respect to '(x,y)'. Values of 0, 0.5, and 1 specify left/bottom, middle and right/top, respectively." But it looks like 0, 1 specify top, bottom respectively in the y direction. plot(1:4) text(2,2, "adj=c(0,0)", adj=c(0,0)) text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the black one... #x-adj is OK text(3,3, "adj=c(0,0)", adj=c(0,0)) text(3,3, "adj=c(1,0)", adj=c(1,0), col=2) [I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff and for expressions as well as text] Perhaps a two-word correction to ?text ? I think it is behaving as I'd expect: the y adjustment of 0 says that the bottom of the text aligns with the specified point, while the y adjustment of 1 says that the top of the text aligns there. This is consistent with the description for x: 0 says the left end aligns, 1 says the right end aligns. The text may be a little terse, but it is consistent. Duncan Murdoch __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Is text(..., adj) upside down? (Or am I?)
S Ellison wrote: ?text says "'adj' allows _adj_ustment of the text with respect to '(x,y)'. Values of 0, 0.5, and 1 specify left/bottom, middle and right/top, respectively." But it looks like 0, 1 specify top, bottom respectively in the y direction. plot(1:4) text(2,2, "adj=c(0,0)", adj=c(0,0)) text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the black one... #x-adj is OK text(3,3, "adj=c(0,0)", adj=c(0,0)) text(3,3, "adj=c(1,0)", adj=c(1,0), col=2) [I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff and for expressions as well as text] Perhaps a two-word correction to ?text ? You're just confused: TOP adjusted text is BELOW bottom-adjusted text. RIGHT adjusted text to the LEFT of left-adjusted text. See? -- O__ Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Is text(..., adj) upside down? (Or am I?)
On Tue, 22 Jul 2008, S Ellison wrote: ?text says "'adj' allows _adj_ustment of the text with respect to '(x,y)'. Values of 0, 0.5, and 1 specify left/bottom, middle and right/top, respectively." But it looks like 0, 1 specify top, bottom respectively in the y direction. plot(1:4) text(2,2, "adj=c(0,0)", adj=c(0,0)) text(2,2, "adj=c(0,1)", adj=c(0,1), col=2) #the red one's below the black one... If that comment is what you see (and I do on X11), it is as documented. In the first text() call the left bottom of the text box is at the specified point. In the second text() call the left top of the text box is at the specified point, so the text box should be lower. #x-adj is OK text(3,3, "adj=c(0,0)", adj=c(0,0)) text(3,3, "adj=c(1,0)", adj=c(1,0), col=2) [I am using r 2.7.1 in windows; adj behaviour is consistent in 2.6.0ff and for expressions as well as text] All 'vertical' adjustment is done in the graphics engine: some 'horizontal' adjustment is done in the devices. Perhaps a two-word correction to ?text ? 'adjustment' is not well-defined for text position, whereas 'alignment' or 'justification' are, so I suggest adding one of those before 'respectively'. Steve Ellison Lab of the Government Chemist UK *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Is text(..., adj) upside down? (Or am I?)
Yup; you're all right - it IS consistent (and I'd even checked the x-adj and it did what I expected!!). It's just that ?text is talking about the position of the 'anchor' point in the text region rather than the subsequent location of the centre of the text. Anyway; if anyone is considering a minor tweak to ?text, would it be clearer if it said "Values of 0, 0.5, and 1 specify text towards right/top, middle and left/bottom of x,y, respectively." ? (or, of course, "Values of 0, 0.5, and 1 specify x,y at left/bottom, middle and right/top of text, respectively.") Steve Ellison Lab of the Government Chemist UK *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Is text(..., adj) upside down? (Or am I?)
Basically the only thing in the thread that was clear to me was Brian's phrasing. So I'd suggest basing any changes on that. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") S Ellison wrote: Yup; you're all right - it IS consistent (and I'd even checked the x-adj and it did what I expected!!). It's just that ?text is talking about the position of the 'anchor' point in the text region rather than the subsequent location of the centre of the text. Anyway; if anyone is considering a minor tweak to ?text, would it be clearer if it said "Values of 0, 0.5, and 1 specify text towards right/top, middle and left/bottom of x,y, respectively." ? (or, of course, "Values of 0, 0.5, and 1 specify x,y at left/bottom, middle and right/top of text, respectively.") Steve Ellison Lab of the Government Chemist UK *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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