Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
Dear David, I would like to use summarize(Hmisc) and print.xtable(xtable) in a single Sweave document, but a conflict with the 'label' function prohibits this at the moment! Would you be able to correct the conflicting code? I will gladly test the new package! I have tried latex(Hmisc) to

RE: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Liaw, Andy
One possible solution without renaming the functions is to add namespace to either xtable or Hmisc. Given the size of Hmisc, it probably would be much easier to do that with xtable. With namespace in xtable, you can do xtable:::label() to refer to the label() in xtable specifically. Andy

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
Even without a namespace one could explicitly reference the label in xtable via: xtable.label - get(label, package:xtable) On 5/16/05, Liaw, Andy [EMAIL PROTECTED] wrote: One possible solution without renaming the functions is to add namespace to either xtable or Hmisc. Given the size of

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
Hi Andy and Gabor, Thanks for your help so far! I am discovering another R dimension. Trying to put my head around all thisthe conflict actually exposes itself when calling summarize(Hmisc). Summarize(Hmisc) calls label internally, so I can not call it explicitly. Simply calling

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
Do you need label in both xtable and Hmisc? If you only need it in Hmisc and not in xtable then just be sure you have loaded xtable first and Hmisc second. This: search() will give you the search path. It will find the first one on the search path so if Hmisc is before xtable (which would

RE: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Liaw, Andy
You need to add the namespace to the source package, by adding a NAMESPACE file. There's an R News article by Prof. Tierney on how to do this. Also see the `Writing R Extensions' manual. You should get the package maintainer to do that, as that constitute a change in the package source code.

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
I tried to follow your suggestions, but without success: Error: couldn't find function xtable.mylabel- ... resulting from the code below. Any suggestions? Thanks, Sander. library(xtable) xtable.mylabel - get(label, package:xtable) library(Hmisc) # provides summarize set.seed(1) temperature -

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread David B. Dahl
Sander, Thanks for pointing out the conflict between Hmisc and xtable. I am not sure I have a good solution. My understand of the namespace solution is that packages can specify which variables to export for use by the package users. The label function is not an internal function, rather one

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
Hi David, Thanks for creating and supporting xtable. Glad I can contribute by pointing out problems! An earlier response from Frank Harrell Jr. suggests that the responsibility to resolve the conflict lies primarily with you, as Hmisc 'was there first'. Not sure how disputes over package

RE: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Liaw, Andy
For fixing the problem you have, you need: xtable.mylabel- - get(label-.xtable, package:xtable) I.e., you need the replacement function. One possibility of resolving the conflict, as I communicated with Frank, is to make label() and label-() in Hmisc the S3 default methods, as xtable defines

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
That seems like a good solution. The one problem is that both packages would need their own label generic functions if they are to operate independently of each other so if they were both loaded the last one loaded would give a warning that the label generic from the first loaded package is

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
Using label as an lvalue (i.e. on the left hand side of the assignment) causes it to refer to a different function, not label itself. Any any rate, looking at your example, it seems that you don't actually need to use Hmisc and xtable at the same time so just make sure that whichever you want

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-13 Thread Frank E Harrell Jr
Sander Oom wrote: Dear R users, The Sweave code below runs fine, as it is. However, an error occurs when the line 'library(xtable)' is uncommented: Error: chunk 1 Error in label-(`*tmp*`, value = month) : no applicable method for label- Is anybody aware of this and knows a workaround?

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-13 Thread Sander Oom
Dear Frank, I have a Sweave document in which I export anova (aov) tables to Latex and calculate some summary statistics with summarize{Hmisc} for a graph (as in the example below). I currently use the following code for the aov tables: results=tex= tmp - datGrassHC[datGrassHC$Loc 0