### Re: [R] sizing and saving graphics in R

Why not plot directly to a bitmapped format, using bmp() or png()? That way you can create a large 'display region' when you open the device. BTW, I guess you are on Windows but you did not say so: bmp() only exists on Windows. On Wed, 30 May 2007, Felicity Jones wrote: Dear R wizards, I am seeking advice on graphics in R. Specifically, how to manipulate the size and save a plot I have produced using the LDheatmap library. I confess I am relatively new to graphics in R, but I would greatly appreciate any suggestions you may have. LDheatmap produces a coloured triangular matrix of pairwise associations between 600 genetic markers in my dataset. Initially the graphical output was confined to the computer screen, such that each pairwise marker association was displayed as approximately 1 pixel (too small for me to interpret). I have successfully managed to play with the LDheatmap function to enlarge the size of viewport by changing the following code in LDheatmap #From heatmapVP - viewport(width = unit(0.8, snpc), height = unit(0.8, snpc), name=vp.name) #To heatmapVP - viewport(width = unit(25, inches), height = unit(25, inches), name=vp.name) This produces a much larger plot (so big that the majority is not seen on the screen). I would like to save the entire thing so that I can import it into photoshop or some other image software. My problem is that when I save using the R graphics console (File-Save As-bmp), it only saves the section I can see on the screen. Any suggestions on how to save the whole plot or manipulate the plot so I get higher resolution would be much appreciated. Thanks for your help in advance, Felicity. Dr Felicity Jones Department of Developmental Biology Stanford University School of Medicine Beckman Center 279 Campus Drive Stanford CA 94305-5329 USA -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] how to preserve trained model in LDA?

On Wed, 30 May 2007, Feng Qiu wrote: Hi all: I'm developing an application in which I use standard data to train the model in LDA and use the trained model to predict on test data. I can't train the model every time when I do prediction. So I need to save the trained model onto disk after the first training. Does anybody have idea about this? You help is highly appreciated. The object lda() returns (assuming you are using lda) is all you need to do prediction. So just use save() to 'save it to disk', and load() to retrieve it when you need it again. -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Generating Data using Formulas

On Wed, 30 May 2007, Charles C. Berry wrote: Christian, The formula language is not suited to such recursive useage AFAICS. But filter() is. In this case the result is an AR(1) process, so arima.sim() could be used (and internally that uses filter). I know this is an exercise, but using 'y0 = 0' is unrealistic: arima.sim allows you to do better. You can _vectorize_ your code like this: cmat - outer( 1:25, 1:25, function(y,x) ifelse( xy, 0, 0.8^(y-x) ) ) res - replicate(1000,{ y - 1 + cmat %*% rnorm(25) coef(lm(y[-1]~y[-25])) }) rowMeans(res) # mean of 1000 replicates HTH, Chuck On Tue, 29 May 2007, Chrisitan Falde wrote: Hello, My name is Christian Falde. I am new to R. My problem is this. I am attempting to learn R on my own. In so doing I am using some problems from Davidson and MacKinnon Econometric Theory and Methods to do so. This is because I can already do the some of the problems in SAS so I am attempting to rework them using R. Seemed logical to me, now I am stuck and its really bugging me. The problem is this Generate a data set sample size of 25 with the formula y=1+.8*y(t-1)+ u. Where y is the dependent, y(t-1) is the dependent variable lagged one peroid, and u is the classical error term. Assume y0=0 and the u is NID(0,1). Use this sample to compute the OLS estimates B1 (1) and B2(.8). Repeat at least 100 times and find the average of the B's. Use these average to estimate the bias of the ols estimators. To start I did the following non lagged program. final-function(i,j){x-function(i) {10*i} y-function(i,j) {1+.8*10*i+100*rnorm(j)} datathreeone- data.frame(replicate(100,coef(lm(y(i,j)~x(i) rowMeans(datathreeone)} final(1:25,25) final(1:50,50) final(1:100,100) final(1:200,200) final(1:1,1) Now the only thing I need to to is change .8*10*i which is exogenous to .8* y(t-1) . There are two reasons why I did it this way. I needed the rnorm(i) to generate a new set of u's each replication, and I wanted to be able to use the function as i did to make the results more concise. For the lag in SAS we used an if then else logic relating to the number of observation. This in R would have to be linked to the invisable row number. I think I need an index variable for the row. Perhaps, sorry thinking while typing. Another reason why I am stuck, the lag function was seemingly straight forward. lag (x, k=1) yet x has to be a matrix so when I tried to do it like above with y as a function R complained. I have been working on this for a couple of days now so everything is begining to not make sense. It just seems to me to get the matrix to work out I would need to have two matrices. dependentand explanatory y1 = sum ( 1 +.8*0 + 100*rnorm(i)) y2 = sum ( 1 +.8* (dependent row 1) + 100*rnorm(i)) etc I just am not sure how to do that. Please help and thank you for your time, christian falde [snip] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Reference for npconmode (in the np package)?

The np package contains a function called npconmode which performs 'kernel modal regression'. Does anyone know of a reference that explains this? The R documentation cites Li and Racine's book, but I couldn't find any reference to kernel modal regression in it. I gather that this is the preferred function for a nonparametric regression with a discrete dependent variable. Based on Li and Racine, I would have thought that a conditional conditional density estimation (i.e. npcdens) was the way to accomplish this. I'd like to understand the difference. thanks, b. wagman __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] lattice: aligning independent graphs

On Thu, 31 May 2007 00:26:00 -0500, Sebastian P. Luque [EMAIL PROTECTED] wrote: [...] which gives wrong width and placement. How can this be modified so it places the labels close to the axis annotation, centered on each panel? Thanks in advance. Ok, this is it I think: --cut here---start- ylabGrob - function(...) { # ...is lab1, lab2, etc labs - lapply(list(...), textGrob, rot=90) nlabs - length(labs) lab.widths - lapply(labs, function(lab) unit(1, grobwidth, data=list(lab))) lab.layout - grid.layout(ncol=1, nrow=nlabs, heights=unit(1, null), widths=do.call(max, lab.widths), respect=TRUE) lab.gf - frameGrob(layout=lab.layout) for (i in seq_len(nlabs)) { lab.gf - placeGrob(lab.gf, labs[[i]], row=i, col=1) } lab.gf } xyplot(1:9 ~ 1:9 | gl(3, 1, 9), layout=c(1, 3), ylab=myXlabGrob('Trial number', 'Subject number', 'Experimental condition'), strip=FALSE) --cut here---end--- -- Seb __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] opinions please: text editors and reporting/Sweave?

Jared == Jared O'Connell [EMAIL PROTECTED] on Thu, 31 May 2007 11:28:11 +0800 writes: Jared Winshell (http://www.winshell.de/) is another (free) option if you want a Jared Windows editor with good MikTEX integration. Looks like it. Note however that the above free is only as in free beer not as in free speech. In other words, Winshell is *not* 'Free Software' / 'Software Libre' nor is it Open Source Software. Tinn-R, as R itself, *is* Free Software (and Emacs and ESS and (La)TeX are too). Martin Maechler, ETH Zurich Jared On 5/31/07, Duncan Murdoch [EMAIL PROTECTED] wrote: Tim Howard wrote: dear all - I currently use Tinn-R as my text editor to work with code that I submit to R, with some output dumped to text files, some images dumped to pdf. (system: Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to create large output data files for GIS, but then I need simple output reports for analysis results for each separate data set. Thus, I create many reports of the same style, but just based on different input data. I am recognizing that I need a better reporting system, so that I can create clean reports for each separate R run. This obviously means using Sweave and some implementation of LaTex, both of which are new to me. I've installed MikTex and successfully completed a demo or two for creating pdfs from raw LaTeX. It appears that if I want to ease my entry into the world of LaTeX, I might need to switch editors to something like Emacs (I read somewhere that Emacs helps with the TeX markup?). After quite a while wallowing at the Emacs site, I am finding that ESS is well integrated with R and might be the way to go. Aaaagh... I'm in way over my head! If you are used to Windows, you might find the shareware editors WinEdt or Textpad more familiar. WinEdt has advantages of lots of LaTeX integration. Duncan Murdoch My questions: What, in your opinion, is the simplest way to integrate text and graphics reports into a single report such as a pdf file. If the answer to this is LaTeX and Sweave, is it difficult to use a text editor such as Tinn-R or would you strongly recommend I leave behind Tinn and move over to an editor that has more LaTeX help? In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am beginning to think I can do everything I need with my simple editor. Before spending many hours going down that path, I thought it prudent to ask the R community. It is likely I am misunderstanding some of the process here and any clarifications are welcome. Thank you in advance for any thoughts. Tim Howard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Jared [[alternative HTML version deleted]] Jared __ Jared R-help@stat.math.ethz.ch mailing list Jared https://stat.ethz.ch/mailman/listinfo/r-help Jared PLEASE do read the posting guide http://www.R-project.org/posting-guide.html Jared and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Choosing a column for analysis in a function

Hello all, I'm having a problem concerning choosing columns from a dataset in a function. I'm writing a function for data input etc., which first reads the data, and then does several data manipulation tasks. The function can be then used, with just giving the path of the .txt file where the data is being held. These datasets consists of over 20 different analytes. Though, statistical analyses should be made seperately analyte by analyte. So the function needs to be able to choose a certain analyte based on what the user of the function gives as a parameter when calling the function. The name of the analyte user gives, is the same as a name of a column in the data set. The question is: how can I refer to the parameter which the user gives, inside the function? I cannot give the name of the analyte directly inside the function, as the same function should work for all the 20 analytes. I'm giving some code for clarification: datainput - function(data1,data2,data3,data4,data5,data6,analyte) { ... ##data1-data6 being the paths of the six datasets I want to combine and analyte being the special analyte I want to analyze and which can be found on each of the datasets as a columnname.## ##Then:## ... data.whole - subset(data.whole, select=c(Sample.Name,Analyte.Values,Day,Plate)) ##Is for choosing the columns needed for analysis. The Analyte should now be the column of the analyte, the users is referring to when calling the datainput-function. How to do it? ## I've tried something like data.whole$Analyte.Values - data.whole$analyte ##(Or in quotes analyte) But this does not work. I've tried several other tricks also, but cannot get it to work. Can someone help? Thanks in advance, Jouni __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Many warnings in the newest R ...

Hello! I am using R 2.5.0 under Ubuntu 6.06, and I am not an expert. Recently, I think from the latest update some warning messages started to appear, when I use my old data-file and R-histories (hence, everything was done before and worked perfectly well). It seems to me that those are related to the Design package, but I am not sure. One is coming out after: d = datadist(a,b,c) Warning message: $ operator is deprecated for atomic vectors, returning NULL in: X[[1]]$terms And the other after using ols() or lrm() etc.: Warning messages: 1: use of storage.mode(x) - single is deprecated: use mode- instead (this one is repeating: 2, 3, 4 times) What I do wrong? Could you help me? I realized that there were some important changes in the newest realises, and that some of them are, probably, related to the above warnings, but still I would like to have an explanation and an advice how to fix if something is wrong. Thanks in advance, PM __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] opinions please: text editors and reporting/Sweave?

Den To, 2007-05-31, 09:01 skrev Martin Maechler: Jared == Jared O'Connell [EMAIL PROTECTED] on Thu, 31 May 2007 11:28:11 +0800 writes: Jared Winshell (http://www.winshell.de/) is another (free) option if you want a Jared Windows editor with good MikTEX integration. Looks like it. Note however that the above free is only as in free beer not as in free speech. In other words, Winshell is *not* 'Free Software' / 'Software Libre' nor is it Open Source Software. Not that I use it myself (since I'm convinced that Emacs is the way to go), but TeXnicCenter (http://www.texniccenter.org/) is probably a good GPL'd alternative to WinShell. HTH, Henric Tinn-R, as R itself, *is* Free Software (and Emacs and ESS and (La)TeX are too). Martin Maechler, ETH Zurich Jared On 5/31/07, Duncan Murdoch [EMAIL PROTECTED] wrote: Tim Howard wrote: dear all - I currently use Tinn-R as my text editor to work with code that I submit to R, with some output dumped to text files, some images dumped to pdf. (system: Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to create large output data files for GIS, but then I need simple output reports for analysis results for each separate data set. Thus, I create many reports of the same style, but just based on different input data. I am recognizing that I need a better reporting system, so that I can create clean reports for each separate R run. This obviously means using Sweave and some implementation of LaTex, both of which are new to me. I've installed MikTex and successfully completed a demo or two for creating pdfs from raw LaTeX. It appears that if I want to ease my entry into the world of LaTeX, I might need to switch editors to something like Emacs (I read somewhere that Emacs helps with the TeX markup?). After quite a while wallowing at the Emacs site, I am finding that ESS is well integrated with R and might be the way to go. Aaaagh... I'm in way over my head! If you are used to Windows, you might find the shareware editors WinEdt or Textpad more familiar. WinEdt has advantages of lots of LaTeX integration. Duncan Murdoch My questions: What, in your opinion, is the simplest way to integrate text and graphics reports into a single report such as a pdf file. If the answer to this is LaTeX and Sweave, is it difficult to use a text editor such as Tinn-R or would you strongly recommend I leave behind Tinn and move over to an editor that has more LaTeX help? In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am beginning to think I can do everything I need with my simple editor. Before spending many hours going down that path, I thought it prudent to ask the R community. It is likely I am misunderstanding some of the process here and any clarifications are welcome. Thank you in advance for any thoughts. Tim Howard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Jared [[alternative HTML version deleted]] Jared __ Jared R-help@stat.math.ethz.ch mailing list Jared https://stat.ethz.ch/mailman/listinfo/r-help Jared PLEASE do read the posting guide http://www.R-project.org/posting-guide.html Jared and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] [R-pkgs] adehabitat version 1.6

Dear all, I have just uploaded to CRAN the version 1.6 of the package 'adehabitat'. Significant changes are listed below: * The package has been reorganized into four parts (see ?adehabitat-package for a description): (i) management of raster maps, (ii) habitat selection / ecological niche analysis, (iii) home range analysis, and (iv) analysis of animals trajects. The package contains several demo files to allow an overview of these parts : demo(rastermaps), demo(homerange), demo(managltraj), demo(analysisltraj), demo(nichehs). * the package now contains a new function allowing the exploration of the ecological niche, which generalizes several factor analyses (ENFA, MADIFA, ...) and is closely related to several methods (Mahalanobis distances, selection ratios, etc.), named gnesfa() (see the examples of the help page for the properties of this analysis). * The class ltraj now distinguishes two types of trajects: type I (time not recorded, e.g. tracks of animals in the snow) and type II (time recorded, e.g. GPS monitoring). Trajects of type II may either be regular (constant time lag between relocations) or not. * Numerous example datasets have been added to the package to illustrate the analysis of animals trajects: 4 porpoises, 6 albatross, 1 hooded seal, 1 whale, 1 brown bear, two roe deer, two chamois, 4 ibex, 1 mouflon, 3 wild boar * Many functions have been added to allow the management of animals trajects within R: Some functions allow to handle the attributes or the storage of the trajects (typeII2typeI, typeI2typeII, sett0, cutltr, is.regular, is.sd, mindistkeep, offsetdate, set.limits), other allow to manage missing values and test their random distribution in the traject (setNA, summaryNAltraj, plotNAltraj, runsNAltraj), other allow a graphical exploration of the properties of the trajects (hist.ltraj, plot.ltraj, plotltr, sliwinltr). * Several functions now allow to test the independence of the descriptive parameters in the trajects (indmove and wawotest for dx, dy and dist, testang.ltraj for rel.angle and abs.angle) * Several functions allow to simulate common models of trajects: the correlated random walk (simm.crw), the brownian motion (simm.brown), the arithmetic brownian motion (simm.mba), the Ornstein Uhlenbeck process (simm.mou), the brownian bridge (simm.bb) and the Levy process (simm.levy). * The function explore.kasc() provides a Tk interface for the exploration of a multi-layer raster map of class kasc * A partitioning algorithm (still under research) is also available to partition a traject into segments with homogeneous properties (see the help page of modpartltraj) * The bugs in redisltraj and mcp.area have been corrected Happy testing, Clément CALENGE -- Clément CALENGE Laboratoire de Biométrie et Biologie évolutive UMR CNRS 5558 43 Bd. 11 Nov. 1918 69622 Villeurbanne Cedex - France Office national de la chasse et de la faune sauvage 95, rue Pierre Flourens 34000 Montpellier ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] opinions please: text editors and reporting/Sweave?

On Thu, 31 May 2007, Henric Nilsson wrote: Den To, 2007-05-31, 09:01 skrev Martin Maechler: Jared == Jared O'Connell [EMAIL PROTECTED] on Thu, 31 May 2007 11:28:11 +0800 writes: Jared Winshell (http://www.winshell.de/) is another (free) option if you want a Jared Windows editor with good MikTEX integration. Looks like it. Note however that the above free is only as in free beer not as in free speech. In other words, Winshell is *not* 'Free Software' / 'Software Libre' nor is it Open Source Software. Not that I use it myself (since I'm convinced that Emacs is the way to go), but TeXnicCenter (http://www.texniccenter.org/) is probably a good GPL'd alternative to WinShell. Our Windows-only users prefer both WinEdt and TeXnicCenter to WinShell. A few get on with Emacs/AucTeX, but not many. Tinn-R, as R itself, *is* Free Software (and Emacs and ESS and (La)TeX are too). Martin Maechler, ETH Zurich Jared On 5/31/07, Duncan Murdoch [EMAIL PROTECTED] wrote: Tim Howard wrote: dear all - I currently use Tinn-R as my text editor to work with code that I submit to R, with some output dumped to text files, some images dumped to pdf. (system: Windows 2K and XP, R 2.4.1 and R 2.5). We are using R for overnight runs to create large output data files for GIS, but then I need simple output reports for analysis results for each separate data set. Thus, I create many reports of the same style, but just based on different input data. I am recognizing that I need a better reporting system, so that I can create clean reports for each separate R run. This obviously means using Sweave and some implementation of LaTex, both of which are new to me. I've installed MikTex and successfully completed a demo or two for creating pdfs from raw LaTeX. It appears that if I want to ease my entry into the world of LaTeX, I might need to switch editors to something like Emacs (I read somewhere that Emacs helps with the TeX markup?). After quite a while wallowing at the Emacs site, I am finding that ESS is well integrated with R and might be the way to go. Aaaagh... I'm in way over my head! If you are used to Windows, you might find the shareware editors WinEdt or Textpad more familiar. WinEdt has advantages of lots of LaTeX integration. Duncan Murdoch My questions: What, in your opinion, is the simplest way to integrate text and graphics reports into a single report such as a pdf file. If the answer to this is LaTeX and Sweave, is it difficult to use a text editor such as Tinn-R or would you strongly recommend I leave behind Tinn and move over to an editor that has more LaTeX help? In reading over Friedrich Leisch's Sweave User Manual (v 1.6.0) I am beginning to think I can do everything I need with my simple editor. Before spending many hours going down that path, I thought it prudent to ask the R community. It is likely I am misunderstanding some of the process here and any clarifications are welcome. Thank you in advance for any thoughts. Tim Howard __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Jared [[alternative HTML version deleted]] Jared __ Jared R-help@stat.math.ethz.ch mailing list Jared https://stat.ethz.ch/mailman/listinfo/r-help Jared PLEASE do read the posting guide http://www.R-project.org/posting-guide.html Jared and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of

### Re: [R] sizing and saving graphics in R

There is also the functions pdf(), jpeg(), bmp() and png() -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Murray Pung Sent: 31 May 2007 01:22 To: Felicity Jones Cc: r-help@stat.math.ethz.ch Subject: Re: [R] sizing and saving graphics in R I use the savePlot function for saving graphics. The following will save the active graphics panel in your working directory, in format wmf, which I find has a high resolution. Check out other possible formats in help. savePlot(filename = myfilename,type = c(wmf)) Murray On 31/05/07, Felicity Jones [EMAIL PROTECTED] wrote: Dear R wizards, I am seeking advice on graphics in R. Specifically, how to manipulate the size and save a plot I have produced using the LDheatmap library. I confess I am relatively new to graphics in R, but I would greatly appreciate any suggestions you may have. LDheatmap produces a coloured triangular matrix of pairwise associations between 600 genetic markers in my dataset. Initially the graphical output was confined to the computer screen, such that each pairwise marker association was displayed as approximately 1 pixel (too small for me to interpret). I have successfully managed to play with the LDheatmap function to enlarge the size of viewport by changing the following code in LDheatmap #From heatmapVP - viewport(width = unit(0.8, snpc), height = unit(0.8, snpc), name=vp.name) #To heatmapVP - viewport(width = unit(25, inches), height = unit(25, inches), name=vp.name) This produces a much larger plot (so big that the majority is not seen on the screen). I would like to save the entire thing so that I can import it into photoshop or some other image software. My problem is that when I save using the R graphics console (File-Save As-bmp), it only saves the section I can see on the screen. Any suggestions on how to save the whole plot or manipulate the plot so I get higher resolution would be much appreciated. Thanks for your help in advance, Felicity. ___ Dr Felicity Jones Department of Developmental Biology Stanford University School of Medicine Beckman Center 279 Campus Drive Stanford CA 94305-5329 USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Murray Pung Statistician, Datapharm Australia Pty Ltd 0404 273 283 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] predict.nls - gives error but only on some nls objects

Dear list, I have encountered a problem with predict.nls (Windows XP, R.2.5.0), but I am not sure if it is a bug... On the nls man page, an example is: DNase1 - subset(DNase, Run == 1) fm2DNase1 - nls(density ~ 1/(1 + exp((xmid - log(conc))/scal)), data = DNase1, start = list(xmid = 0, scal = 1)) alg = plinear, trace = TRUE) Now consider prediction: predict(fm2DNase1) [1] 0.001424337 0.001424337 0.028883648 0.028883648 . predict(fm2DNase1,newdata=fm2DNase1) Error in if (sum(wrong) == 1) stop(gettextf(variable '%s' was fitted with class \%s\ but class \%s\ was supplied, : missing value where TRUE/FALSE needed What causes the trouble is the call to .checkMFClasses(cl, newdata) in predict.nls. Incidently, on the predict.nls page the example works: fm - nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD) predict(fm) [1] 7.887449 12.524977 15.251673 16.854870 17.797490 18.677580 predict(fm,newdata=BOD) [1] 7.887449 12.524977 15.251673 16.854870 17.797490 18.677580 attr(,gradient) A lrc [1,] 0.4120369 5.977499 [2,] 0.6542994 7.029098 Is there a bug, or am I overlooking something?? Regards Søren [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] A matrix with mixed character and numerical columns

Is it possible to have one? I have a data.frame with two character columns and 6 numerical columns. I converted to a matrix as I needed to use the col() and row() functions. However, if I convert the data.frame to a matrix, using as.matrix, the numerical columns get converted to characters, and that messes up some of the calculations. Do I really have to split it up into two matrices, one character and the other numerical, just so I can use the col() and row() functions? Are there equivalent functions for data.frames? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Accessing plots in Trellis graphics

Hi, I used xyplot to create conditional scatterplots. My layout is 5x3 plots, but my data contains only 14 subgroups. So I would like to use the empty plot to display additional information about the data. How can I access the plot? Thanks in advance Sigbert --- Here my call: xyplot(yf~xf|id, data=data, pch=19, cex=0.5, col=black, panel=function(x,y, subscripts, ...) { ... }, strip=function(..., factor.levels, fg, bg) strip.default(..., factor.levels=levels, style=4, strip.names=c(F,F), strip.levels=c(F,T), fg=bg), layout=c(5,3), ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Where is CRAN mirror address stored?

When I update.packages(), R shows the dialog window, listing CRAN mirrors and asks to choose the CRAN mirror to use in this session. Then, R uses this address and never asks again until quit. Is there any way to make R ask for the CRAN mirror again, except restarting it? I am just trying to save typing, because sometimes my internet connection with CRAN becomes too slow, and mirrors disappear. -- View this message in context: http://www.nabble.com/Where-is-CRAN-mirror-address-stored--tf3845953.html#a10891857 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Where is CRAN mirror address stored?

chooseCRANmirror() -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vladimir Eremeev Sent: 31 May 2007 12:14 To: r-help@stat.math.ethz.ch Subject: [R] Where is CRAN mirror address stored? When I update.packages(), R shows the dialog window, listing CRAN mirrors and asks to choose the CRAN mirror to use in this session. Then, R uses this address and never asks again until quit. Is there any way to make R ask for the CRAN mirror again, except restarting it? I am just trying to save typing, because sometimes my internet connection with CRAN becomes too slow, and mirrors disappear. -- View this message in context: http://www.nabble.com/Where-is-CRAN-mirror-address-stored--tf3845953.htm l#a10891857 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Accessing plots in Trellis graphics

I used similar empty space to place the legend, by specifying the placement coordinates to the key argument of xyplot. This was rather long time ago, and I had to explicitly form the list, used as the key argument for this function. Lattice has evolved since that, some automation has appeared. Try also using panel.identify, trellis.focus and other functions, listed on the help page together with these two. Sigbert Klinke wrote: I used xyplot to create conditional scatterplots. My layout is 5x3 plots, but my data contains only 14 subgroups. So I would like to use the empty plot to display additional information about the data. How can I access the plot? -- View this message in context: http://www.nabble.com/Accessing-plots-in-Trellis-graphics-tf3845949.html#a10892051 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] A matrix with mixed character and numerical columns

Hi Michael, I dont think it is possible. Please see first the definition of a dataframe and matrix - Original Message From: michael watson (IAH-C) [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, May 31, 2007 4:18:11 PM Subject: [R] A matrix with mixed character and numerical columns Is it possible to have one? I have a data.frame with two character columns and 6 numerical columns. I converted to a matrix as I needed to use the col() and row() functions. However, if I convert the data.frame to a matrix, using as.matrix, the numerical columns get converted to characters, and that messes up some of the calculations. Do I really have to split it up into two matrices, one character and the other numerical, just so I can use the col() and row() functions? Are there equivalent functions for data.frames? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Odp: A matrix with mixed character and numerical columns

Hi [EMAIL PROTECTED] napsal dne 31.05.2007 12:48:11: Is it possible to have one? I have a data.frame with two character columns and 6 numerical columns. I converted to a matrix as I needed to use the col() and row() functions. However, if I convert the data.frame to a matrix, using as.matrix, the numerical columns get converted to characters, and that messes up some of the calculations. Do I really have to split it up into two matrices, one character and the other numerical, just so I can use the col() and row() functions? Are there equivalent functions for data.frames? AFAIK I do not remember equivalent functions for data frame. If you just want column or row index you can use 1:dim(DF)[1] or 1:dim(DF)[2] for rows and columns if you want repeat these indexes row or columnwise use rrr-rep(1:dim(DF)[1], dim(DF)[2]) matrix(rrr,dim(DF)[1], dim(DF)[2]) rrr-rep(1:dim(DF)[2], dim(DF)[1]) matrix(rrr,dim(DF)[1], dim(DF)[2], byrow=T) Regards Petr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Does tail(capture.output(traceback()),n=1) do what you want? that is error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) parent-tail(capture.output(traceback()),n=1) parent-gsub([0-9]: ,,parent) # deleting 1: from the captured string tkinsert(tkmsg, end, sprintf(Error in %s: %s, parent , msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } Sundar Dorai-Raj wrote: Hi, All, I'm writing a wrapper for stop that produces a popup window using tcltk. Something like: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } But, I would like to know from which function error() is called. For example, if I have foo - function() stop() bar - function() error() foo() Error in foo() : bar() Error in error() : and in the tk window I get Error in ???: I need the output of bar (in the tk window only) to be Error in bar(): then it's clear where error is called. I'm not worried about the output bar() produces on the console. Hope this makes sense. Thanks, -- View this message in context: http://www.nabble.com/determining-a-parent-function-name-tf3843262.html#a10892459 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] installing problems

Would like to share that I am having the exact same problem running on Ubuntu 7.04 trying to install the R-2.5.0.tar.gz file After trying './configure' I also get the same error message: configure: error: --with-readline=yes (default) and headers/libs are not available Hope some one can help us out on this one Cheers, Daniel Xyoby Chavez wrote: hi every body. Im new in this program. Im traying to install R in linux suse10.0 in two following form: a) with the file R-2.5.0.tar.gz b) and the rpm file : R-base-2.5.0-2.1.i586.rpm ** In the first case a) when i uncompressed and type: linux:/opt/R/R-2.5.0 # ./configure the followind message is showed linux:/opt/R/R-2.5.0 # ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu loading site script './config.site' loading build specific script './config.site' checking for pwd... /bin/pwd checking whether builddir is srcdir... yes . . . checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available linux:/opt/R/R-2.5.0 # after that i try to do : linux:/opt/R/R-2.5.0 # make make: *** No targets specified and no makefile found. Stop. i installed : xorg-x11-devel and libpng-devel ,suggested by somebody and nothing. **Affter with b) tray to install with the YAST. It installed without errors, but when i try to run R the following message is showed: /usr/lib/R/bin/exec/R: error while loading shared libraries: libgfortran.so.0: cannot open shared object file: No such file or directory then i do linux:/usr/lib # ln /opt/gnat/lib/libgfortran.so libgfortran.so.0 it also doesnt work. Thanks for yor help Xyoby Chavez P Lima Peru __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/installing-problems-tf3806626.html#a10892609 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Vladimir Eremeev wrote: Does tail(capture.output(traceback()),n=1) do what you want? that is Hmmm... Seems, no... Having the earlier error() definition and bar-function() error(asdasdf) ft-function() bar() ft() I get in the tcl/tk window: Error in bar(): asdasdf bar() I get in the tcl/tk window: Error in ft(): asdasdf I get in the tcl/tk window: Error in bar(): asdasdf Some kind of the stack flushing is needed. .Traceback-NULL did not help -- View this message in context: http://www.nabble.com/determining-a-parent-function-name-tf3843262.html#a10892608 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] installing problems

INSTALL says The main source of information on installation is the `R Installation and Administration Manual', an HTML copy of which is available as file `doc/html/R-admin.html'. Please read that before installing R. But if you are impatient, read on but please refer to the manual to resolve any problems. The 'problem' is discussed in detail in that manual. On Thu, 31 May 2007, dohyedan wrote: Would like to share that I am having the exact same problem running on Ubuntu 7.04 trying to install the R-2.5.0.tar.gz file After trying './configure' I also get the same error message: configure: error: --with-readline=yes (default) and headers/libs are not available Hope some one can help us out on this one Cheers, Daniel Xyoby Chavez wrote: hi every body. Im new in this program. Im traying to install R in linux suse10.0 in two following form: a) with the file R-2.5.0.tar.gz b) and the rpm file : R-base-2.5.0-2.1.i586.rpm ** In the first case a) when i uncompressed and type: linux:/opt/R/R-2.5.0 # ./configure the followind message is showed linux:/opt/R/R-2.5.0 # ./configure checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu loading site script './config.site' loading build specific script './config.site' checking for pwd... /bin/pwd checking whether builddir is srcdir... yes . . . checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available linux:/opt/R/R-2.5.0 # after that i try to do : linux:/opt/R/R-2.5.0 # make make: *** No targets specified and no makefile found. Stop. i installed : xorg-x11-devel and libpng-devel ,suggested by somebody and nothing. **Affter with b) tray to install with the YAST. It installed without errors, but when i try to run R the following message is showed: /usr/lib/R/bin/exec/R: error while loading shared libraries: libgfortran.so.0: cannot open shared object file: No such file or directory then i do linux:/usr/lib # ln /opt/gnat/lib/libgfortran.so libgfortran.so.0 it also doesnt work. Thanks for yor help Xyoby Chavez P Lima Peru __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Estimate Fisher Information by Hessian from OPTIM

ChenYen wrote: Dear All, I am trying to find MLE by using OPTIM function. Difficult in differentiating some parameter in my objective function, I would like to use the returned hessian matrix to yield an estimate of Fisher's Information matrix. My question: Since the hessian is calculated by numerical differentiate, is it a reliable estimate? Otherwise I would have to do a lot of work to write a second derivative on my own. Thank you very much in advance [[alternative HTML version deleted]] When the objective function is based on a smooth function (in particular, a mix of exponentials) then in my experience the Fisher information matrix is the same as estimated via the finite difference approximation in numericDeriv or via analytical derivatives -- e.g., for the results discussed in Katharine M. Mullen, Mikas Vengris, and Ivo H. M. van Stokkum. Algorithms for separable nonlinear least squares with application to modelling time-resolved spectra. /Journal of Global Optimization/, vol 38, n 2, 201-213, 2007 (at http://www.nat.vu.nl/~kate/jgo2005.ps) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] predict.nls - gives error but only on some nls objects

Why do you think feeding a model fit (fm2DNase1) is suitable 'newdata'?. From the help page newdata: A named list or data frame in which to look for variables with which to predict. If 'newdata' is missing the fitted values at the original data points are returned. It is the unsuitable 'newdata' that is causing the error. On Thu, 31 May 2007, Søren Højsgaard wrote: Dear list, I have encountered a problem with predict.nls (Windows XP, R.2.5.0), but I am not sure if it is a bug... On the nls man page, an example is: DNase1 - subset(DNase, Run == 1) fm2DNase1 - nls(density ~ 1/(1 + exp((xmid - log(conc))/scal)), data = DNase1, start = list(xmid = 0, scal = 1)) alg = plinear, trace = TRUE) Now consider prediction: predict(fm2DNase1) [1] 0.001424337 0.001424337 0.028883648 0.028883648 . predict(fm2DNase1,newdata=fm2DNase1) Error in if (sum(wrong) == 1) stop(gettextf(variable '%s' was fitted with class \%s\ but class \%s\ was supplied, : missing value where TRUE/FALSE needed What causes the trouble is the call to .checkMFClasses(cl, newdata) in predict.nls. Incidently, on the predict.nls page the example works: fm - nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD) predict(fm) [1] 7.887449 12.524977 15.251673 16.854870 17.797490 18.677580 predict(fm,newdata=BOD) [1] 7.887449 12.524977 15.251673 16.854870 17.797490 18.677580 attr(,gradient) A lrc [1,] 0.4120369 5.977499 [2,] 0.6542994 7.029098 Is there a bug, or am I overlooking something?? Regards Søren [[alternative HTML version deleted]] -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Venn diagram

Hello, I am a total beginner with “R” and found a package “venn” to create a venn diagram. The problem is, I cannot create the vectors required for the diagram. The manual say: R venn(accession, libname, main = All samples) where accession was a vector containing the codes identifying the RNA sequences, and libname was a vector containing the codes identifying the tissue sample (library). The structure of my data is as follows: R structure(list(cyto = c(A, “B”, “C”, “D”), nuc = c(“A”, “B”, “E”, “”), chrom = c(“B”, “F”, “”, “”)),.Names = c(cyto, Nuc, chrom)) accession should be A, B, and libname schould be cyto, nuc and chrom as I understand it... Could you help me? Sorry, that might be a very simple question, but I am a total beginner as said before! The question has already been asked, but unfortunately there was no answer... Thank you a lot, Nina Hubner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Partially reading a file (particularly)

The responses are much appreciated, thanks. findstr works and saves a lot of time. I didn't however have much success with that exact code persay; I get an error message that I don't understand, as follows: c1 - read.fwf(pipe(findstr /b 5 my.file), ...) Error in readLines(con, n, ok, warn, encoding) : 'con' is not a connection Error in close(file) : no applicable method for close I did however have success with pipe using readLines, albeit in a very clumsy fashion: c1 - readLines(pipe(findstr /b 5 my.file)) write(c1, file=temp.dat) t1 - read.fwf(temp.dat, ...) Do you receive the same error message as above when using pipe with read.fwf? -- jared tobin, student research assistant dept. of fisheries and oceans [EMAIL PROTECTED] -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 10:51 PM To: Charles C. Berry Cc: Tobin, Jared; r-help@stat.math.ethz.ch Subject: Re: [R] Partially reading a file (particularly) On 5/29/07, Charles C. Berry [EMAIL PROTECTED] wrote: On windows XP we can also use findstr which comes with Windows: res - read.fwf( pipe( findstr /b 5 my.file ) , other args ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] A matrix with mixed character and numerical columns

What I am trying to do is create an x-y plot from the numerical values, and the output of row() or col() gives me an excellent way of calculating an x- or y- co-ordinate, with the value in the data.frame being the other half of the pair. Thanks for the code, Petr - I'm sure you would agree, however, that it's a bit 'clumsy' (no fault of yours). Can we just adjust row() and col() for data.frames? col - function (x, as.factor = FALSE) { if (is.data.frame(x)) { x - as.matrix(x) } if (as.factor) factor(.Internal(col(x)), labels = colnames(x)) else .Internal(col(x)) } row - function (x, as.factor = FALSE) { if (is.data.frame(x)) { x - as.matrix(x) } if (as.factor) factor(.Internal(row(x)), labels = rownames(x)) else .Internal(row(x)) } Is there any reason why these won't work? Am I oversimplifying it? Mick -Original Message- From: Petr PIKAL [mailto:[EMAIL PROTECTED] Sent: 31 May 2007 12:57 To: michael watson (IAH-C) Cc: r-help@stat.math.ethz.ch Subject: Odp: [R] A matrix with mixed character and numerical columns Hi [EMAIL PROTECTED] napsal dne 31.05.2007 12:48:11: Is it possible to have one? I have a data.frame with two character columns and 6 numerical columns. I converted to a matrix as I needed to use the col() and row() functions. However, if I convert the data.frame to a matrix, using as.matrix, the numerical columns get converted to characters, and that messes up some of the calculations. Do I really have to split it up into two matrices, one character and the other numerical, just so I can use the col() and row() functions? Are there equivalent functions for data.frames? AFAIK I do not remember equivalent functions for data frame. If you just want column or row index you can use 1:dim(DF)[1] or 1:dim(DF)[2] for rows and columns if you want repeat these indexes row or columnwise use rrr-rep(1:dim(DF)[1], dim(DF)[2]) matrix(rrr,dim(DF)[1], dim(DF)[2]) rrr-rep(1:dim(DF)[2], dim(DF)[1]) matrix(rrr,dim(DF)[1], dim(DF)[2], byrow=T) Regards Petr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] loading several samples of data from hard-drive, run lm, rlm, etc, save results in a list

I have many sample datasets (e.g. sample 5, sample 6, etc), each identified by a number as a suffix. These datasets are saved as individual R objects on my hard drive. (e.g.Wind.5.r . Wind.6.r,Solar.5.r,Solar.6.r) For example purposes, I have written code that creates similar data files using the airquality dataset. (see below) #this creates my sample data files library(datasets) getwd() #fyi for(m in 5:9) { tempdata=subset(airquality,Month==m) for (col in 1:4){ tempdata2 = tempdata[col] tempname=paste(names(airquality)[col],m,sep=.) assign(tempname,tempdata2,pos=.GlobalEnv ) save( list=tempname , file = paste(tempname,.r,sep= ) ) rm(tempdata2,list=tempname,tempname) } rm(tempdata,col,m) } (While it might be possible to combine all the data into one large R-object, I have chosen not to do so. Due to the large size of my datasets, and the way they are organized, I feels it does make sense to keep them as individual files.) I wish to load several variables from each sample, to perform a regression using the lm function, and to then save the all the regressions as objects in a list. Here is the code I have written. Is there a better/simpler way to do this? (Ideally, I'd like the model I specify to be flexible, and to be able to use not only lm, but also rlm, etc. (I have simplified my code for this example, but I think this repasts the essential parts of what I am trying to accomplish.) ) #my code to run a regression for each sample (i.e.samples 5,6,7,8, 9), #this saves the regression results in a list called results y='Ozone' x=c('Wind','Temp') results=list(NULL) for (i in 5:9) { load(file = paste(y,i,r ,sep=.), envir = .GlobalEnv) y1=get(paste(y,i,sep=.)) for (d in 1:length(x)) { load(file = paste(x[d],i,r ,sep=.), envir = .GlobalEnv) assign(paste(x,d,sep=),get(paste(x[d],i,sep=.) )) } #end d loop reg - lm(y1[,1]~x1[,1]+x2[,1]) results[i-5] - list(reg) names(results)[i-5] - i #need to add a line to remove any data files loaded } summary(results[[1]]) summary(results[[2]]) lapply(results,summary) - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Conditional logistic regression for events/trials format

Dear R users, I have a large individual-level dataset (~700,000 records) which I am performing a conditional logistic regression on. Key variables include the dichotomous outcome, dichotomous exposure, and the stratum to which each person belongs. Using this individual-level dataset I can successfully use clogit to create the model I want. However reading this large .csv file into R and running the models takes a fair amount of time. Alternatively, I could choose to collapse the dataset so that each row has the number of events, number of individuals, and the exposure and stratum. In SAS they call this the events/trials format. This would make my dataset much smaller and presumably speed things up. So my question is: can I use clogit (or possibly another function) to perform a conditional logistic regression when the data is in this events/trials format? I am using R version 2.5.0. Thank you very much, Matt Strickland Birth Defects Branch U.S. Centers for Disease Control __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Partially reading a file (particularly)

Try this: con - pipe(findstr /b 5 myfile.dat) open(con, r) DF - read.fwf(con, widths = c(1, 1, 2)) # replace with right args close(con) On 5/31/07, Tobin, Jared [EMAIL PROTECTED] wrote: The responses are much appreciated, thanks. findstr works and saves a lot of time. I didn't however have much success with that exact code persay; I get an error message that I don't understand, as follows: c1 - read.fwf(pipe(findstr /b 5 my.file), ...) Error in readLines(con, n, ok, warn, encoding) : 'con' is not a connection Error in close(file) : no applicable method for close I did however have success with pipe using readLines, albeit in a very clumsy fashion: c1 - readLines(pipe(findstr /b 5 my.file)) write(c1, file=temp.dat) t1 - read.fwf(temp.dat, ...) Do you receive the same error message as above when using pipe with read.fwf? -- jared tobin, student research assistant dept. of fisheries and oceans [EMAIL PROTECTED] -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 10:51 PM To: Charles C. Berry Cc: Tobin, Jared; r-help@stat.math.ethz.ch Subject: Re: [R] Partially reading a file (particularly) On 5/29/07, Charles C. Berry [EMAIL PROTECTED] wrote: On windows XP we can also use findstr which comes with Windows: res - read.fwf( pipe( findstr /b 5 my.file ) , other args ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Hi, Vladimir, In general, this won't work since traceback only contains the stack from the last uncaught error (see ?traceback). When traceback is called below it would be from the previous error, not the current one. error - function() { parent - tail(capture.output(traceback()), n = 1) parent - sub(^.*:[ ]+, , parent) stop(parent) } foo - function() error() bar - function() error() foo() Error in error() : No traceback available bar() Error in error() : foo() Thanks, --sundar Vladimir Eremeev said the following on 5/31/2007 4:57 AM: Does tail(capture.output(traceback()),n=1) do what you want? that is error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) parent-tail(capture.output(traceback()),n=1) parent-gsub([0-9]: ,,parent) # deleting 1: from the captured string tkinsert(tkmsg, end, sprintf(Error in %s: %s, parent , msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } Sundar Dorai-Raj wrote: Hi, All, I'm writing a wrapper for stop that produces a popup window using tcltk. Something like: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } But, I would like to know from which function error() is called. For example, if I have foo - function() stop() bar - function() error() foo() Error in foo() : bar() Error in error() : and in the tk window I get Error in ???: I need the output of bar (in the tk window only) to be Error in bar(): then it's clear where error is called. I'm not worried about the output bar() produces on the console. Hope this makes sense. Thanks, __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Hi, Vladimir, Sorry, didn't see this reply. .Traceback - NULL doesn't work because of the warning in ?traceback. Warning: It is undocumented where '.Traceback' is stored nor that it is visible, and this is subject to change. Prior to R 2.4.0 it was stored in the workspace, but no longer. Thanks, --sundar Vladimir Eremeev said the following on 5/31/2007 5:10 AM: Vladimir Eremeev wrote: Does tail(capture.output(traceback()),n=1) do what you want? that is Hmmm... Seems, no... Having the earlier error() definition and bar-function() error(asdasdf) ft-function() bar() ft() I get in the tcl/tk window: Error in bar(): asdasdf bar() I get in the tcl/tk window: Error in ft(): asdasdf I get in the tcl/tk window: Error in bar(): asdasdf Some kind of the stack flushing is needed. .Traceback-NULL did not help __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] A matrix with mixed character and numerical columns

[EMAIL PROTECTED] napsal dne 31.05.2007 14:32:01: What I am trying to do is create an x-y plot from the numerical values, and the output of row() or col() gives me an excellent way of calculating an x- or y- co-ordinate, with the value in the data.frame being the other half of the pair. Thanks for the code, Petr - I'm sure you would agree, however, that it's a bit 'clumsy' (no fault of yours). Can we just adjust row() and col() for data.frames? col - function (x, as.factor = FALSE) { if (is.data.frame(x)) { x - as.matrix(x) } if (as.factor) factor(.Internal(col(x)), labels = colnames(x)) else .Internal(col(x)) } row - function (x, as.factor = FALSE) { if (is.data.frame(x)) { x - as.matrix(x) } if (as.factor) factor(.Internal(row(x)), labels = rownames(x)) else .Internal(row(x)) } Is there any reason why these won't work? Am I oversimplifying it? Seems to me that both works. At least on data.frame I tried it. Regards Petr Mick -Original Message- From: Petr PIKAL [mailto:[EMAIL PROTECTED] Sent: 31 May 2007 12:57 To: michael watson (IAH-C) Cc: r-help@stat.math.ethz.ch Subject: Odp: [R] A matrix with mixed character and numerical columns Hi [EMAIL PROTECTED] napsal dne 31.05.2007 12:48:11: Is it possible to have one? I have a data.frame with two character columns and 6 numerical columns. I converted to a matrix as I needed to use the col() and row() functions. However, if I convert the data.frame to a matrix, using as.matrix, the numerical columns get converted to characters, and that messes up some of the calculations. Do I really have to split it up into two matrices, one character and the other numerical, just so I can use the col() and row() functions? Are there equivalent functions for data.frames? AFAIK I do not remember equivalent functions for data frame. If you just want column or row index you can use 1:dim(DF)[1] or 1:dim(DF)[2] for rows and columns if you want repeat these indexes row or columnwise use rrr-rep(1:dim(DF)[1], dim(DF)[2]) matrix(rrr,dim(DF)[1], dim(DF)[2]) rrr-rep(1:dim(DF)[2], dim(DF)[1]) matrix(rrr,dim(DF)[1], dim(DF)[2], byrow=T) Regards Petr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Selective 'expansion' of arguments in a match.call() result ...

Is it possible to write a support function to automatize selective argument expansion (based on argument value type) as in the following example, in order to write terse code even when there are many arguments? Forcing evaluation of all arguments is not a problem ... __Thanks a lot!__R_ # When called with document = 1, we have the simple match.call() result, # when document = 2 and name is a string, it is expanded, otherwise it # is not example - function (name, document = FALSE) { print(name) if(document == 1) { resh - match.call() } else if (document == 2) { resh - match.call() if(is.character(name)) { resh$name - name } resh$document - document } else { resh - call(undef) } resh } a - Roberto b - 1 example(a, document = 1) [1] Roberto example(name = a, document = 1) example(a, document = 2) [1] Roberto example(name = Roberto, document = 2) example(b, document = 2) [1] 1 example(name = b, document = 2) -- r/ | Roberto Brunelli - [scientist at Fondazione Bruno Kessler-irst] | 'Home can be anywhere, for it is a part of one's self' -- ITC - dall'1 marzo 2007 Fondazione Bruno Kessler ITC - since 1 March 2007 Fondazione Bruno Kessler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Selective 'expansion' of arguments in a match.call() result ...

Try this: # ith arg is expanded if expand[[i]] is TRUE where expand is # extended to vector of same length as ... . # default is to expand all args if 1st arg is character example2 - function(..., expand = is.character(..1)) { L - list(...) expand - rep(expand, length = length(L)) mc - match.call() mc$expand - NULL for(i in which(expand)) mc[[i+1]] - L[[i]] mc } # test a - b - 1 example2(a, b) d - a example2(d, b) example2(a, b, expand = TRUE) example2(a, b, expand = c(TRUE, FALSE)) On 5/31/07, Roberto Brunelli [EMAIL PROTECTED] wrote: Is it possible to write a support function to automatize selective argument expansion (based on argument value type) as in the following example, in order to write terse code even when there are many arguments? Forcing evaluation of all arguments is not a problem ... __Thanks a lot!__R_ # When called with document = 1, we have the simple match.call() result, # when document = 2 and name is a string, it is expanded, otherwise it # is not example - function (name, document = FALSE) { print(name) if(document == 1) { resh - match.call() } else if (document == 2) { resh - match.call() if(is.character(name)) { resh$name - name } resh$document - document } else { resh - call(undef) } resh } a - Roberto b - 1 example(a, document = 1) [1] Roberto example(name = a, document = 1) example(a, document = 2) [1] Roberto example(name = Roberto, document = 2) example(b, document = 2) [1] 1 example(name = b, document = 2) -- r/ | Roberto Brunelli - [scientist at Fondazione Bruno Kessler-irst] | 'Home can be anywhere, for it is a part of one's self' -- ITC - dall'1 marzo 2007 Fondazione Bruno Kessler ITC - since 1 March 2007 Fondazione Bruno Kessler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] VGAM package

Hi, R-users Could someone help me to understand this following error. I'm using vglm function in VGAM package Best regards and thank you for your ehlp mydata - read.table(Data2_overruns.csv, sep =;, header = T, row.names=NULL) attach(mydata) y - mydata$cat.event phase.vol -mydata$phase.vol pilote - mydata$pilote défail.méca - mydata$défail.méca mauv.visib - mydata$mauv.visibilité piste.cont - mydata$piste.contam vent - mydata$vent tiers - mydata$tiers y - ordered(y,levels=c(Inci,Inci G,Acci)) dat - data.frame(y,phase.vol,pilote, défail.méca, + mauv.visibilité, piste.cont, vent, tiers) pilote_sum-apply(tab_cont,1,sum) #somme sur les lignes Event_sum-apply(tab_cont,2,sum) # somme sur les colonnes library(VGAM) Le chargement a nécessité le package : splines Le chargement a nécessité le package : stats4 Attachement du package : 'VGAM' The following object(s) are masked from package:splines : bs, ns The following object(s) are masked from package:stats : glm, lm, poly, predict.glm, predict.lm, predict.mlm The following object(s) are masked from package:base : scale.default result - vglm(y ~ phase.vol + pilote + défail.méca + mauv.visib + piste.cont + vent + tiers,data = dat, family = cumulative(parallel = F)) Erreur dans dotC(name = tapplymat1, mat = as.double(mat), as.integer(nr), : NA/NaN/Inf dans un appel à une fonction externe (argument 1) De plus : Warning messages: 1: using type=numeric with a factor response will be ignored in: model.response(mf, numeric) 2: production de NaN in: log(x) 3: fitted values close to 0 or 1 in: Deviance.categorical.data.vgam(mu = mu, y = y, w = w, residuals = residuals, 4: production de NaN in: log(x) 5: fitted values close to 0 or 1 in: Deviance.categorical.data.vgam(mu = mu, y = y, w = w, residuals = residuals, Lassana KOITA Chargé d'Etudes de Sécurité Aéroportuaire et d'Analyse Statistique / Project Engineer Airport Safety Studies Statistical analysis Service Technique de l'Aviation Civile (STAC) / Civil Aviation Technical Department Direction Générale de l'Aviation Civile (DGAC) / French Civil Aviation Headquarters Tel: 01 49 56 80 60 Fax: 01 49 56 82 14 E-mail: [EMAIL PROTECTED] http://www.stac.aviation-civile.gouv.fr/ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] plotting variable sections of hourly time series data using plot.zoo

Dear list, I have to look examine hourly time - series and would like to plot variable section of them using plot.zoo. Hourly time series data which looks like this: MM DD HHP-ukP-kor P-SME EPOTEREA RO R1 R2 RGES S-SNO SISSM SUZSLZ 2003 1 1 10.385 0.456 0.021 0.000 0.000 0.000 0.013 0.223 0.2350.010.38 74.720.96 736.51 2003 1 1 20.230 0.275 0.028 0.000 0.000 0.000 0.012 0.223 0.2350.030.56 74.720.94 736.37 #With help of read.table I got the data into R : DF - read.table(file=fn,header=FALSE,skip=2) #Substitute the header: names(DF) - c(year,month,day,hour,FN,Punc,Pcor,Pmelt,ETP,ETR,RS,RI,RB,Rtot,Ssnow,SI,SSM,SUZ,SLZ) #Create datetime vector library(chron) DF$datetime - with(DF,chron(paste(month,day,year,sep=/))+hour/24) #Try to convert DF into ts - object DFts DFts - as.ts(DF) # works, but gives back: Warning message: Class information of one or more columns was lost.??? #Try to convert DF into zoo - object DFzoo library(zoo) DFzoo - as.zoo(DFts) #Plot of whole time series skipping first 5 and last 3 columns plot.zoo(DFzoo[ ,6:ncol(myDFzoo-3)]) # works, but x-axis labels are numbers from 1 to ...last hour I would like to use plot.zoo for plotting: - the whole period (3years) -- axis-labels month and year - section of few days defining begin and end as date -- axis-label day and month (may be hour) Afer long tries with as.Date and Co. I still didn't get any useful result. Further is there any possibility to define the plot window using two variables like: begin - 22/2/2003 01:00:00 end - 26/3/2003 07:00:00 to plot the time series section in between this two dates? I am even not sure if the zoo package was the right choise for my problem. Thanks a lot in advance Best regards Jan University of Berne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Choosing a column for analysis in a function

Perhaps the use of as.character() like following might help? data.whole$Analyte.Values - data.whole$as.character(analyte) Junnila, Jouni wrote: Hello all, I'm having a problem concerning choosing columns from a dataset in a function. I'm writing a function for data input etc., which first reads the data, and then does several data manipulation tasks. The function can be then used, with just giving the path of the .txt file where the data is being held. These datasets consists of over 20 different analytes. Though, statistical analyses should be made seperately analyte by analyte. So the function needs to be able to choose a certain analyte based on what the user of the function gives as a parameter when calling the function. The name of the analyte user gives, is the same as a name of a column in the data set. The question is: how can I refer to the parameter which the user gives, inside the function? I cannot give the name of the analyte directly inside the function, as the same function should work for all the 20 analytes. I'm giving some code for clarification: datainput - function(data1,data2,data3,data4,data5,data6,analyte) { ... ##data1-data6 being the paths of the six datasets I want to combine and analyte being the special analyte I want to analyze and which can be found on each of the datasets as a columnname.## ##Then:## ... data.whole - subset(data.whole, select=c(Sample.Name,Analyte.Values,Day,Plate)) ##Is for choosing the columns needed for analysis. The Analyte should now be the column of the analyte, the users is referring to when calling the datainput-function. How to do it? ## I've tried something like data.whole$Analyte.Values - data.whole$analyte ##(Or in quotes analyte) But this does not work. I've tried several other tricks also, but cannot get it to work. Can someone help? Thanks in advance, Jouni __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] cox goodness of fit

Hi, assuming you are doing a Cox-PH-Model, you can check: library(survival) ?coxph.object There it says that the components 'residuals' refers to the martingale residuals. I hope I recall it correctly but there exists a simple relation between the martingale residuals ('mgr') and the unmodified cox-snell residuals ('ucs'): ucs = delta - mgr where delta refers to your event indicator (0=censored, 1=event). I don't have the books with me at the moment, but I think I learned about residuals in a survival context either in Klein/Moeschberger: Survival Analysis or in Tableman/Sung Kim: Survival Analysis Using S I hope this helps, Roland Murray Pung wrote: Is there an implementation of the Cox-Snell residuals / Nelson-Aalen plot for goodness of fit? Or otherwise is there an appropriate Goodness of Fit diagnostic? Thanks Murray __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] plotting variable sections of hourly time series data using plot.zoo

Regarding your other questions: plot(z[,3:5]) # only plot columns 3 to 5 # only plot between indicated times st - chron(01/01/03, 02:00:00) en - chron(03/26/2003, 07:00:00) zz - window(z, start = st, end = en) plot(zz) On 5/31/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: There seems to be an error in your names(DF) - line so I just renamed the first 4 fields. Try this: # Should be 3 lines in Lines. Lines - MM DD HHP-ukP-kor P-SME EPOTEREA RO R1 R2 RGES S-SNO SISSM SUZSLZ 2003 1 1 10.385 0.456 0.021 0.000 0.000 0.000 0.013 0.223 0.2350.010.38 74.720.96 736.51 2003 1 1 20.230 0.275 0.028 0.000 0.000 0.000 0.012 0.223 0.2350.030.56 74.720.94 736.37 DF - read.table(textConnection(Lines), header = TRUE) names(DF)[1:4] - c(year, month, day, hour) library(chron) library(zoo) z - zoo(as.matrix(DF), with(DF,chron(paste(month,day,year,sep=/))+hour/24)) as.ts(z) On 5/31/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear list, I have to look examine hourly time - series and would like to plot variable section of them using plot.zoo. Hourly time series data which looks like this: MM DD HHP-ukP-kor P-SME EPOTEREA RO R1 R2 RGES S-SNO SISSM SUZSLZ 2003 1 1 10.385 0.456 0.021 0.000 0.000 0.000 0.013 0.223 0.2350.010.38 74.720.96 736.51 2003 1 1 20.230 0.275 0.028 0.000 0.000 0.000 0.012 0.223 0.2350.030.56 74.720.94 736.37 #With help of read.table I got the data into R : DF - read.table(file=fn,header=FALSE,skip=2) #Substitute the header: names(DF) - c(year,month,day,hour,FN,Punc,Pcor,Pmelt,ETP,ETR,RS,RI,RB,Rtot,Ssnow,SI,SSM,SUZ,SLZ) #Create datetime vector library(chron) DF$datetime - with(DF,chron(paste(month,day,year,sep=/))+hour/24) #Try to convert DF into ts - object DFts DFts - as.ts(DF) # works, but gives back: Warning message: Class information of one or more columns was lost.??? #Try to convert DF into zoo - object DFzoo library(zoo) DFzoo - as.zoo(DFts) #Plot of whole time series skipping first 5 and last 3 columns plot.zoo(DFzoo[ ,6:ncol(myDFzoo-3)]) # works, but x-axis labels are numbers from 1 to ...last hour I would like to use plot.zoo for plotting: - the whole period (3years) -- axis-labels month and year - section of few days defining begin and end as date -- axis-label day and month (may be hour) Afer long tries with as.Date and Co. I still didn't get any useful result. Further is there any possibility to define the plot window using two variables like: begin - 22/2/2003 01:00:00 end - 26/3/2003 07:00:00 to plot the time series section in between this two dates? I am even not sure if the zoo package was the right choise for my problem. Thanks a lot in advance Best regards Jan University of Berne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Venn diagram

I cannot find the venn package (searched the author's page and googled) despite some posts referring to it, so I cannot help you. But I can suggest you check out the varpart in vegan package, vennDiagram in limma package or http://finzi.psych.upenn.edu/R/Rhelp02a/archive/14637.html Regards, Adai Nina Hubner wrote: Hello, I am a total beginner with “R” and found a package “venn” to create a venn diagram. The problem is, I cannot create the vectors required for the diagram. The manual say: R venn(accession, libname, main = All samples) where accession was a vector containing the codes identifying the RNA sequences, and libname was a vector containing the codes identifying the tissue sample (library). The structure of my data is as follows: R structure(list(cyto = c(A, “B”, “C”, “D”), nuc = c(“A”, “B”, “E”, “”), chrom = c(“B”, “F”, “”, “”)),.Names = c(cyto, Nuc, chrom)) accession should be A, B, and libname schould be cyto, nuc and chrom as I understand it... Could you help me? Sorry, that might be a very simple question, but I am a total beginner as said before! The question has already been asked, but unfortunately there was no answer... Thank you a lot, Nina Hubner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] plotting variable sections of hourly time series data using plot.zoo

There seems to be an error in your names(DF) - line so I just renamed the first 4 fields. Try this: # Should be 3 lines in Lines. Lines - MM DD HHP-ukP-kor P-SME EPOTEREA RO R1 R2 RGES S-SNO SISSM SUZSLZ 2003 1 1 10.385 0.456 0.021 0.000 0.000 0.000 0.013 0.223 0.2350.010.38 74.720.96 736.51 2003 1 1 20.230 0.275 0.028 0.000 0.000 0.000 0.012 0.223 0.2350.030.56 74.720.94 736.37 DF - read.table(textConnection(Lines), header = TRUE) names(DF)[1:4] - c(year, month, day, hour) library(chron) library(zoo) z - zoo(as.matrix(DF), with(DF,chron(paste(month,day,year,sep=/))+hour/24)) as.ts(z) On 5/31/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear list, I have to look examine hourly time - series and would like to plot variable section of them using plot.zoo. Hourly time series data which looks like this: MM DD HHP-ukP-kor P-SME EPOTEREA RO R1 R2 RGES S-SNO SISSM SUZSLZ 2003 1 1 10.385 0.456 0.021 0.000 0.000 0.000 0.013 0.223 0.2350.010.38 74.720.96 736.51 2003 1 1 20.230 0.275 0.028 0.000 0.000 0.000 0.012 0.223 0.2350.030.56 74.720.94 736.37 #With help of read.table I got the data into R : DF - read.table(file=fn,header=FALSE,skip=2) #Substitute the header: names(DF) - c(year,month,day,hour,FN,Punc,Pcor,Pmelt,ETP,ETR,RS,RI,RB,Rtot,Ssnow,SI,SSM,SUZ,SLZ) #Create datetime vector library(chron) DF$datetime - with(DF,chron(paste(month,day,year,sep=/))+hour/24) #Try to convert DF into ts - object DFts DFts - as.ts(DF) # works, but gives back: Warning message: Class information of one or more columns was lost.??? #Try to convert DF into zoo - object DFzoo library(zoo) DFzoo - as.zoo(DFts) #Plot of whole time series skipping first 5 and last 3 columns plot.zoo(DFzoo[ ,6:ncol(myDFzoo-3)]) # works, but x-axis labels are numbers from 1 to ...last hour I would like to use plot.zoo for plotting: - the whole period (3years) -- axis-labels month and year - section of few days defining begin and end as date -- axis-label day and month (may be hour) Afer long tries with as.Date and Co. I still didn't get any useful result. Further is there any possibility to define the plot window using two variables like: begin - 22/2/2003 01:00:00 end - 26/3/2003 07:00:00 to plot the time series section in between this two dates? I am even not sure if the zoo package was the right choise for my problem. Thanks a lot in advance Best regards Jan University of Berne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Hi sundar -- maybe myerr - function(err) err$call foo - function() stop() tryCatch({ foo() }, error=myerr) foo() suggests a way to catch errors without having to change existing code or re-invent stop? Martin Sundar Dorai-Raj [EMAIL PROTECTED] writes: Hi, Vladimir, Sorry, didn't see this reply. .Traceback - NULL doesn't work because of the warning in ?traceback. Warning: It is undocumented where '.Traceback' is stored nor that it is visible, and this is subject to change. Prior to R 2.4.0 it was stored in the workspace, but no longer. Thanks, --sundar Vladimir Eremeev said the following on 5/31/2007 5:10 AM: Vladimir Eremeev wrote: Does tail(capture.output(traceback()),n=1) do what you want? that is Hmmm... Seems, no... Having the earlier error() definition and bar-function() error(asdasdf) ft-function() bar() ft() I get in the tcl/tk window: Error in bar(): asdasdf bar() I get in the tcl/tk window: Error in ft(): asdasdf I get in the tcl/tk window: Error in bar(): asdasdf Some kind of the stack flushing is needed. .Traceback-NULL did not help __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Martin Morgan Bioconductor / Computational Biology http://bioconductor.org __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] A matrix with mixed character and numerical columns

OK, where is the best place to post these to to get them incorporated in R? -Original Message- From: Petr PIKAL [mailto:[EMAIL PROTECTED] Sent: 31 May 2007 14:23 To: michael watson (IAH-C) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] A matrix with mixed character and numerical columns [EMAIL PROTECTED] napsal dne 31.05.2007 14:32:01: What I am trying to do is create an x-y plot from the numerical values, and the output of row() or col() gives me an excellent way of calculating an x- or y- co-ordinate, with the value in the data.frame being the other half of the pair. Thanks for the code, Petr - I'm sure you would agree, however, that it's a bit 'clumsy' (no fault of yours). Can we just adjust row() and col() for data.frames? col - function (x, as.factor = FALSE) { if (is.data.frame(x)) { x - as.matrix(x) } if (as.factor) factor(.Internal(col(x)), labels = colnames(x)) else .Internal(col(x)) } row - function (x, as.factor = FALSE) { if (is.data.frame(x)) { x - as.matrix(x) } if (as.factor) factor(.Internal(row(x)), labels = rownames(x)) else .Internal(row(x)) } Is there any reason why these won't work? Am I oversimplifying it? Seems to me that both works. At least on data.frame I tried it. Regards Petr Mick -Original Message- From: Petr PIKAL [mailto:[EMAIL PROTECTED] Sent: 31 May 2007 12:57 To: michael watson (IAH-C) Cc: r-help@stat.math.ethz.ch Subject: Odp: [R] A matrix with mixed character and numerical columns Hi [EMAIL PROTECTED] napsal dne 31.05.2007 12:48:11: Is it possible to have one? I have a data.frame with two character columns and 6 numerical columns. I converted to a matrix as I needed to use the col() and row() functions. However, if I convert the data.frame to a matrix, using as.matrix, the numerical columns get converted to characters, and that messes up some of the calculations. Do I really have to split it up into two matrices, one character and the other numerical, just so I can use the col() and row() functions? Are there equivalent functions for data.frames? AFAIK I do not remember equivalent functions for data frame. If you just want column or row index you can use 1:dim(DF)[1] or 1:dim(DF)[2] for rows and columns if you want repeat these indexes row or columnwise use rrr-rep(1:dim(DF)[1], dim(DF)[2]) matrix(rrr,dim(DF)[1], dim(DF)[2]) rrr-rep(1:dim(DF)[2], dim(DF)[1]) matrix(rrr,dim(DF)[1], dim(DF)[2], byrow=T) Regards Petr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] distribution of peaks in random data results

Dear all, I have the positions of N points spread through some sequence of length L (LN), and I would like to know how can do the following: 1- Permute the positions of the N points along the whole sequence. Assuming a uniform distribution I did: position1 - runif(N, 1, L) 2- Apply a kernel convolution method to the resulting permuted points profile. For this I applied the function: d - density(position1, bw = sj) 3- Record the heights of all peaks. For this I used the estimated density values from the output of the density function above: heights1 - d$y 4- Repeat step 1 and 2 to be able to have a distribution of the peaks from the random data results. I don´t know how to perform this step!!! 5- Compute the threshold by determining the alfa-level in the empirical CDF of the null distribution. Assuming ´heightsALL´ is the output of step 4 I would do this: plot(ecdf(heightsALL)). But I don´t know how to compute the threshold 6- Apply this threshold to the peaks estimate of the real peaks data, resulting in a series of significant peaks. This step can be done by seeing the peaks in the real data that are above the threshold and classify these as significant at the alfa-level. The steps mentioned above are better illustrated with a picture that can be fetched here: http://www.yousendit.com/transfer.php?action=downloadufid=0E3724F26CA53367 Best regards and thanks in advance, João Fadista Ph.d. student UNIVERSITY OF AARHUS Faculty of Agricultural Sciences Dept. of Genetics and Biotechnology Blichers Allé 20, P.O. BOX 50 DK-8830 Tjele Phone: +45 8999 1900 Direct: +45 8999 1900 E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Web: www.agrsci.org http://www.agrsci.org/ News and news media http://www.agrsci.org/navigation/nyheder_og_presse . This email may contain information that is confidential. Any use or publication of this email without written permission from Faculty of Agricultural Sciences is not allowed. If you are not the intended recipient, please notify Faculty of Agricultural Sciences immediately and delete this email. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] confidence band

Hello, I made a function, which calculates the confidence interval and the prediction interval, but if I want to plot it, then it plots only the regressionline. Maybe somebody can help me: conf.band - function(x,y) { res.lsfit - lsfit(x,y) xi - seq(from=40, to=160, length=200) n - length(x) MSE - sqrt(sum(res.lsfit$residuals^2)/(n-2)) # confidence interval band - sqrt(2*qf(0.95,2,n-2)) * MSE * sqrt(1/n+(xi-length(x))^2/(var(x)*(n-1))) uiv - res.lsfit$coef[1] + res.lsfit$coef[2]*xi - band oiv - res.lsfit$coef[1] + res.lsfit$coef[2]*xi + band # prediction interval band - sqrt(2*qf(0.95,2,n-2)) * MSE * sqrt(1+1/n +(xi-mean(x))^2/(var(x)*(n-1))) uip - res.lsfit$coef[1] + res.lsfit$coef[2]*xi - band oip - res.lsfit$coef[1] + res.lsfit$coef[2]*xi + band # creating the graphik plot(x, y, xlab=colnames(x), ylab=colnames(y), pch=19) abline(res.lsfit, col=1) matlines(xi, cbind(uiv,oiv), col=3, lty=2, lwd=2) matlines(xi, cbind(uiv,oip), col=2, lty=3, lwd=2) } -- Mit freundlichen Grüssen / Best Regards Soare Marcian-Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Venn diagram

I'm not sure where you're getting the venn package. I don't find venn in either of these places: - http://cran.r-project.org/src/contrib/PACKAGES.html - http://www.bioconductor.org/packages/release/Software.html In case this helps, here are some notes about creating Venn Diagrams using the limma package: http://research.stowers-institute.org/efg/R/Math/VennDiagram.htm efg Stowers Institute for Medical Research Nina Hubner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am a total beginner with R and found a package venn to create a venn diagram. The problem is, I cannot create the vectors required for the diagram. The manual say: R venn(accession, libname, main = All samples) where accession was a vector containing the codes identifying the RNA sequences, and libname was a vector containing the codes identifying the tissue sample (library). The structure of my data is as follows: R structure(list(cyto = c(A, B, C, D), nuc = c(A, B, E, ), chrom = c(B, F, , )),.Names = c(cyto, Nuc, chrom)) accession should be A, B, and libname schould be cyto, nuc and chrom as I understand it... Could you help me? Sorry, that might be a very simple question, but I am a total beginner as said before! The question has already been asked, but unfortunately there was no answer... Thank you a lot, Nina Hubner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Per-row minima for matrix

Hi all, Probably a very easy question, but I was wondering whether or not it is possible to calculate the per-row (or per-column) minima and maxima for a matrix object. Thanks in advance, Dirk -- Dirk De Becker Work: Kasteelpark Arenberg 30 3001 Heverlee phone: ++32(0)16/32.14.44 fax: ++32(0)16/32.85.90 Home: Waversebaan 90 3001 Heverlee phone: ++32(0)16/23.36.65 [EMAIL PROTECTED] mobile phone: ++32(0)498/51.19.86 Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Where is CRAN mirror address stored?

?chooseCRANmirror [help.search(CRAN mirror) found this.] On Thu, 31 May 2007, Vladimir Eremeev wrote: When I update.packages(), R shows the dialog window, listing CRAN mirrors and asks to choose the CRAN mirror to use in this session. Then, R uses this address and never asks again until quit. Is there any way to make R ask for the CRAN mirror again, except restarting it? I am just trying to save typing, because sometimes my internet connection with CRAN becomes too slow, and mirrors disappear. -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Comparing multiple distributions

Nobody answered my first request. I am sorry if I did not explain my problem clearly. English is not my native language and statistical english is even more difficult. I'll try to summarize my issue in more appropriate statistical terms: Each of my observations is not a single number but a vector of 5 proportions (which add up to 1 for each observation). I want to compare the shape of those vectors between two treatments (i.e. how the quantities are distributed between the 5 values in treatment A with respect to treatment B). I was pointed to Hotelling T-squared. Does it seem appropriate? Are there other possibilities (I read many discussions about hotelling vs. manova but I could not see how any of those related to my particular case)? Thank you very much in advance for your insights. See below for my earlier, more detailed, e-mail. On 2007-May-21 , at 19:26 , jiho wrote: I am studying the vertical distribution of plankton and want to study its variations relatively to several factors (time of day, species, water column structure etc.). So my data is special in that, at each sampling site (each observation), I don't have *one* number, I have *several* numbers (abundance of organisms in each depth bin, I sample 5 depth bins) which describe a vertical distribution. Then let say I want to compare speciesA with speciesB, I would end up trying to compare a group of several distributions with another group of several distributions (where a distribution is a vector of 5 numbers: an abundance for each depth bin). Does anyone know how I could do this (with R obviously ;) )? Currently I kind of get around the problem and: - compute mean abundance per depth bin within each group and compare the two mean distributions with a ks.test but this obviously diminishes the power of the test (I only compare 5*2 observations) - restrict the information at each sampling site to the mean depth weighted by the abundance of the species of interest. This way I have one observation per station but I reduce the information to the mean depths while the actual repartition is important also. I know this is probably not directly R related but I have already searched around for solutions and solicited my local statistics expert... to no avail. So I hope that the stats' experts on this list will help me. Thank you very much in advance. JiHO --- http://jo.irisson.free.fr/ -- Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé. CRI UPVD http://www.univ-perp.fr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Venn diagram

There is a venn package at these links: http://fisher.stats.uwo.ca/faculty/murdoch/repos/html/vennv1.5.html http://www.jstatsoft.org/v11/c01/ On 5/31/07, Earl F. Glynn [EMAIL PROTECTED] wrote: I'm not sure where you're getting the venn package. I don't find venn in either of these places: - http://cran.r-project.org/src/contrib/PACKAGES.html - http://www.bioconductor.org/packages/release/Software.html In case this helps, here are some notes about creating Venn Diagrams using the limma package: http://research.stowers-institute.org/efg/R/Math/VennDiagram.htm efg Stowers Institute for Medical Research Nina Hubner [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am a total beginner with R and found a package venn to create a venn diagram. The problem is, I cannot create the vectors required for the diagram. The manual say: R venn(accession, libname, main = All samples) where accession was a vector containing the codes identifying the RNA sequences, and libname was a vector containing the codes identifying the tissue sample (library). The structure of my data is as follows: R structure(list(cyto = c(A, B, C, D), nuc = c(A, B, E, ), chrom = c(B, F, , )),.Names = c(cyto, Nuc, chrom)) accession should be A, B, and libname schould be cyto, nuc and chrom as I understand it... Could you help me? Sorry, that might be a very simple question, but I am a total beginner as said before! The question has already been asked, but unfortunately there was no answer... Thank you a lot, Nina Hubner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Comparing multiple distributions

Your data is compositional data. The R package compositions might be useful. You might also want to consult the book by J. Aitchison: statistical analysis of compositional data. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jiho Sent: Thursday, May 31, 2007 11:37 AM To: R-help Subject: Re: [R] Comparing multiple distributions Nobody answered my first request. I am sorry if I did not explain my problem clearly. English is not my native language and statistical english is even more difficult. I'll try to summarize my issue in more appropriate statistical terms: Each of my observations is not a single number but a vector of 5 proportions (which add up to 1 for each observation). I want to compare the shape of those vectors between two treatments (i.e. how the quantities are distributed between the 5 values in treatment A with respect to treatment B). I was pointed to Hotelling T-squared. Does it seem appropriate? Are there other possibilities (I read many discussions about hotelling vs. manova but I could not see how any of those related to my particular case)? Thank you very much in advance for your insights. See below for my earlier, more detailed, e-mail. On 2007-May-21 , at 19:26 , jiho wrote: I am studying the vertical distribution of plankton and want to study its variations relatively to several factors (time of day, species, water column structure etc.). So my data is special in that, at each sampling site (each observation), I don't have *one* number, I have *several* numbers (abundance of organisms in each depth bin, I sample 5 depth bins) which describe a vertical distribution. Then let say I want to compare speciesA with speciesB, I would end up trying to compare a group of several distributions with another group of several distributions (where a distribution is a vector of 5 numbers: an abundance for each depth bin). Does anyone know how I could do this (with R obviously ;) )? Currently I kind of get around the problem and: - compute mean abundance per depth bin within each group and compare the two mean distributions with a ks.test but this obviously diminishes the power of the test (I only compare 5*2 observations) - restrict the information at each sampling site to the mean depth weighted by the abundance of the species of interest. This way I have one observation per station but I reduce the information to the mean depths while the actual repartition is important also. I know this is probably not directly R related but I have already searched around for solutions and solicited my local statistics expert... to no avail. So I hope that the stats' experts on this list will help me. Thank you very much in advance. JiHO --- http://jo.irisson.free.fr/ -- Ce message a iti virifii par MailScanner pour des virus ou des polluriels et rien de suspect n'a iti trouvi. CRI UPVD http://www.univ-perp.fr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Import data from Access

Hi, I want to import some data from Access and I am using the following codes: testdb - file.path(c/../db1) channel - odbcConnect(testdb) sqlFetch(channel,tbl,colnames = TRUE, rownames = FALSE) It comes out the error message: 1: [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 2: ODBC connection failed in: odbcDriverConnect(st, ...) Anyone can help me sort it out? Many thanks. -- View this message in context: http://www.nabble.com/Import--data-from-Access-tf3847342.html#a10896743 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Per-row minima for matrix

apply(mat1, 1, min) should do it ( or max ) --- Dirk De Becker [EMAIL PROTECTED] wrote: Hi all, Probably a very easy question, but I was wondering whether or not it is possible to calculate the per-row (or per-column) minima and maxima for a matrix object. Thanks in advance, Dirk -- Dirk De Becker Work: Kasteelpark Arenberg 30 3001 Heverlee phone: ++32(0)16/32.14.44 fax: ++32(0)16/32.85.90 Home: Waversebaan 90 3001 Heverlee phone: ++32(0)16/23.36.65 [EMAIL PROTECTED] mobile phone: ++32(0)498/51.19.86 Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Standard errors of the predicted values from a lme (or lmer)-object

Hi how do I obtain standard errors of the predicted values from a lme (or lmer)-object? Thanks ## Dr. Fränzi Korner-Nievergelt oikostat - Statistische Analysen und Beratung Ausserdorf 43 6218 Ettiswil Tel: +41 (0) 41 980 49 22 [EMAIL PROTECTED] www.oikostat.ch # [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] mahalanobis

Hi, I am not sure I am using correctly the mahalanobis distnace method... Suppose I have a response variable Y and predictor variables X1 and X2 all - cbind(Y, X1, X2) mahalanobis(all, colMeans(all), cov(all)); However, my results from this are different from the ones I am getting using another statistical software. I was reading that the comparison is with the means of the predictor variables which led me to think that the above should be transformed into: predictors - cbind(X1, X2) mahalanobis(all, colMeans(predictors), cov(all)) But still the results are different Am I doing something wrong or have I misunderstood something in the use of the function mahalanobis? Thanks. -- yianni __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Venn diagram

I'm really glad to see this topic come up. Area-proportional Venn diagrams are a phantastic way to visualize agreement. For the 2-rater scenario this is straightforward; here are two examples from my own work that were done in R. (I'm far too embarrassed to enclose the code). http://myweb.dal.ca/partes/venn_example.jpg For 3 (or more!) variables, it becomes tricky, but Chow and Ruskey have solved this recently (see link below). http://www.cs.uvic.ca/~ruskey/Publications/VennArea/VennArea.html I think there is even a Java applet for demonstration purposes. It would be phantastic to have a good R-implementation of this... Unfortunately my own skills are several log units below what's required. I have written to Chow and Ruskey before but unfortunately not heard anything. Anyone up for the job?? Best wishes Paul Nina Hubner wrote: Hello, I am a total beginner with “R” and found a package “venn” to create a venn diagram. The problem is, I cannot create the vectors required for the diagram. The manual say: R venn(accession, libname, main = All samples) where accession was a vector containing the codes identifying the RNA sequences, and libname was a vector containing the codes identifying the tissue sample (library). The structure of my data is as follows: R structure(list(cyto = c(A, “B”, “C”, “D”), nuc = c(“A”, “B”, “E”, “”), chrom = c(“B”, “F”, “”, “”)),.Names = c(cyto, Nuc, chrom)) accession should be A, B, and libname schould be cyto, nuc and chrom as I understand it... Could you help me? Sorry, that might be a very simple question, but I am a total beginner as said before! The question has already been asked, but unfortunately there was no answer... Thank you a lot, Nina Hubner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Venn-diagram-tf3846402.html#a10897668 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Comparing multiple distributions

While Ravi's suggestion of the compositions package is certainly appropriate, I suspect that the complex and extensive statistical homework you would need to do to use it might be overwhelming (the geometry of compositions is a simplex, and this makes things hard). As a simple and perhaps useful alternative, use pairs() or splom() to plot your 5-D data, distinguishing the different treatments via color and/or symbol. In addition, it might be useful to do the same sort of plot on the first two principal components (?prcomp) of the first 4 dimensions of your 5 component vectors (since the 5th is determined by the first 4). Because of the simplicial geometry, this PCA approach is not right, but it may nevertheless be revealing. The same plotting ideas are in the compositions package done properly (in the correct geometry),so if you are motivated to do so, you can do these things there. Even if you don't dig into the details, using the compositions package version of the plots may be realtively easy to do,interpretable, and revealing -- more so than my simple but wrong suggestions. You can decide. I would not trust inference using ad hoc approaches in the untransformed data. That's what the package is for. But plotting the data should always be at least the first thing you do anyway. I often find it to be sufficient, too. Bert Gunter Genentech Nonclinical Statistics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jiho Sent: Thursday, May 31, 2007 8:37 AM To: R-help Subject: Re: [R] Comparing multiple distributions Nobody answered my first request. I am sorry if I did not explain my problem clearly. English is not my native language and statistical english is even more difficult. I'll try to summarize my issue in more appropriate statistical terms: Each of my observations is not a single number but a vector of 5 proportions (which add up to 1 for each observation). I want to compare the shape of those vectors between two treatments (i.e. how the quantities are distributed between the 5 values in treatment A with respect to treatment B). I was pointed to Hotelling T-squared. Does it seem appropriate? Are there other possibilities (I read many discussions about hotelling vs. manova but I could not see how any of those related to my particular case)? Thank you very much in advance for your insights. See below for my earlier, more detailed, e-mail. On 2007-May-21 , at 19:26 , jiho wrote: I am studying the vertical distribution of plankton and want to study its variations relatively to several factors (time of day, species, water column structure etc.). So my data is special in that, at each sampling site (each observation), I don't have *one* number, I have *several* numbers (abundance of organisms in each depth bin, I sample 5 depth bins) which describe a vertical distribution. Then let say I want to compare speciesA with speciesB, I would end up trying to compare a group of several distributions with another group of several distributions (where a distribution is a vector of 5 numbers: an abundance for each depth bin). Does anyone know how I could do this (with R obviously ;) )? Currently I kind of get around the problem and: - compute mean abundance per depth bin within each group and compare the two mean distributions with a ks.test but this obviously diminishes the power of the test (I only compare 5*2 observations) - restrict the information at each sampling site to the mean depth weighted by the abundance of the species of interest. This way I have one observation per station but I reduce the information to the mean depths while the actual repartition is important also. I know this is probably not directly R related but I have already searched around for solutions and solicited my local statistics expert... to no avail. So I hope that the stats' experts on this list will help me. Thank you very much in advance. JiHO --- http://jo.irisson.free.fr/ -- Ce message a iti virifii par MailScanner pour des virus ou des polluriels et rien de suspect n'a iti trouvi. CRI UPVD http://www.univ-perp.fr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Different fonts on different axes

Hi Folks, How do I get red bold font on my y axis and black standard font on my x axis? plot(runif(10), ylab=Red, Bold?, xlab=Black, standard?) Any pointers or examples would be great. Thanks! Hank Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Different fonts on different axes

Try this: plot(runif(10), ylab=, xlab=Black, standard?) mtext('Red, Bold', side=2, line=3, col='red', font=2) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Henry H. Stevens Sent: Thursday, May 31, 2007 11:00 AM To: R-Help Subject: [R] Different fonts on different axes Hi Folks, How do I get red bold font on my y axis and black standard font on my x axis? plot(runif(10), ylab=Red, Bold?, xlab=Black, standard?) Any pointers or examples would be great. Thanks! Hank Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Import data from Access

You need to do 1 of 2 things (but not both). Either register your database file with your odbc driver (done outside of R) Or Use odbcConnectAccess in place of odbcConnect The 2nd is simpler if you just want to import that file, the first may be better in the long run if you are going to be working with the database quite a bit. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of livia Sent: Thursday, May 31, 2007 9:55 AM To: r-help@stat.math.ethz.ch Subject: [R] Import data from Access Hi, I want to import some data from Access and I am using the following codes: testdb - file.path(c/../db1) channel - odbcConnect(testdb) sqlFetch(channel,tbl,colnames = TRUE, rownames = FALSE) It comes out the error message: 1: [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 2: ODBC connection failed in: odbcDriverConnect(st, ...) Anyone can help me sort it out? Many thanks. -- View this message in context: http://www.nabble.com/Import--data-from-Access-tf3847342.html# a10896743 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Factor analysis

Hi, is there any other routine for factor analysis in R then factanal? Basically I'am interested in another extraction method then the maximum likelihood method and looking for unweighted least squares. Thanks in advance Sigbert Klinke __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Different fonts on different axes

Martin Henry H. Stevens said the following on 5/31/2007 9:59 AM: Hi Folks, How do I get red bold font on my y axis and black standard font on my x axis? plot(runif(10), ylab=Red, Bold?, xlab=Black, standard?) Any pointers or examples would be great. Thanks! Hank Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Try: plot(runif(10), xlab = , ylab = ) title(xlab = Index) title(ylab = y, font.lab = 2, col.lab = red) HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Import data from Access

library(RODBC); mdbConnect - odbcConnectAccess(C:\\db.mdb); data - sqlFetch(mdbConnect, tblData); odbcClose(mdbConnect); On 5/31/07, livia [EMAIL PROTECTED] wrote: Hi, I want to import some data from Access and I am using the following codes: testdb - file.path(c/../db1) channel - odbcConnect(testdb) sqlFetch(channel,tbl,colnames = TRUE, rownames = FALSE) It comes out the error message: 1: [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 2: ODBC connection failed in: odbcDriverConnect(st, ...) Anyone can help me sort it out? Many thanks. -- View this message in context: http://www.nabble.com/Import--data-from-Access-tf3847342.html#a10896743 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- WenSui Liu A lousy statistician who happens to know a little programming (http://spaces.msn.com/statcompute/blog) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Different fonts on different axes

There's also this approach plot(runif(10), ylab=list(Red, Bold?, col = red, font = 2), xlab=Black, standard?) On 5/31/07, Greg Snow [EMAIL PROTECTED] wrote: Try this: plot(runif(10), ylab=, xlab=Black, standard?) mtext('Red, Bold', side=2, line=3, col='red', font=2) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Henry H. Stevens Sent: Thursday, May 31, 2007 11:00 AM To: R-Help Subject: [R] Different fonts on different axes Hi Folks, How do I get red bold font on my y axis and black standard font on my x axis? plot(runif(10), ylab=Red, Bold?, xlab=Black, standard?) Any pointers or examples would be great. Thanks! Hank Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Rochester, Minn. USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Conditional logistic regression for events/trials format

On Thu, 31 May 2007, Strickland, Matthew (CDC/CCHP/NCBDDD) (CTR) wrote: Dear R users, I have a large individual-level dataset (~700,000 records) which I am performing a conditional logistic regression on. Key variables include the dichotomous outcome, dichotomous exposure, and the stratum to which each person belongs. Using this individual-level dataset I can successfully use clogit to create the model I want. However reading this large .csv file into R and running the models takes a fair amount of time. Alternatively, I could choose to collapse the dataset so that each row has the number of events, number of individuals, and the exposure and stratum. In SAS they call this the events/trials format. This would make my dataset much smaller and presumably speed things up. I think you have described the data for forming a 2 by 2 by K table of counts. In which case, loglin(), loglm(), mantelhaen.test(), and - if K is not too large - glm(... , family=poisson) would be suitable. But you say 'models' above suggesting that there are some other variables. If so, you need to be a bit more specific in describing your setup. So my question is: can I use clogit (or possibly another function) to perform a conditional logistic regression when the data is in this events/trials format? I am using R version 2.5.0. Thank you very much, Matt Strickland Birth Defects Branch U.S. Centers for Disease Control __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] recompile R using ActiveTcl

Dear all, While running some code requiring the tcltk package I have realised that my version of R was compiled with the Tcl/Tk libraries included in Fedora 6. It would be for me better to use the ActiveTcl libraries (which I have under /usr/local), and I'm aware that this probably means to recompile R with the proper configuration variables. But...is it by any chance possible to just recompile the bit affected by Tcl/Tk, like, for instance, to install tcltk with some environment variable pointing at the right ActiveTcl library? Many thanks for your suggestions and help. J -- Dr James Foadi Membrane Protein Laboratory Diamond Light Source Ltd. Diamond House Harwell Science and Innovation Campus Didcot Oxfordshire OX11 0DE United Kingdom email: [EMAIL PROTECTED] [EMAIL PROTECTED] web page (old page - working on a new one): http://www-users.york.ac.uk/~jf117 Tel: 0044 (0)1235 778790 Mobile: 0044 (0)7740 678548 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Different fonts on different axes

Man, you folks rock! Thanks to Greg, Sundar, and Stephen for excellent stuff. Hank On May 31, 2007, at 1:24 PM, Stephen Weigand wrote: There's also this approach plot(runif(10), ylab=list(Red, Bold?, col = red, font = 2), xlab=Black, standard?) On 5/31/07, Greg Snow [EMAIL PROTECTED] wrote: Try this: plot(runif(10), ylab=, xlab=Black, standard?) mtext('Red, Bold', side=2, line=3, col='red', font=2) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Martin Henry H. Stevens Sent: Thursday, May 31, 2007 11:00 AM To: R-Help Subject: [R] Different fonts on different axes Hi Folks, How do I get red bold font on my y axis and black standard font on my x axis? plot(runif(10), ylab=Red, Bold?, xlab=Black, standard?) Any pointers or examples would be great. Thanks! Hank Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. -- Rochester, Minn. USA Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Comparing multiple distributions

On 2007-May-31 , at 18:56 , Bert Gunter wrote: While Ravi's suggestion of the compositions package is certainly appropriate, I suspect that the complex and extensive statistical homework you would need to do to use it might be overwhelming (the geometry of compositions is a simplex, and this makes things hard). Yes I am reading the documentation now, which is well written but huge indeed... As a simple and perhaps useful alternative, use pairs() or splom() to plot your 5-D data, distinguishing the different treatments via color and/or symbol. In addition, it might be useful to do the same sort of plot on the first two principal components (?prcomp) of the first 4 dimensions of your 5 component vectors (since the 5th is determined by the first 4). Because of the simplicial geometry, this PCA approach is not right, but it may nevertheless be revealing. The same plotting ideas are in the compositions package done properly (in the correct geometry),so if you are motivated to do so, you can do these things there. Even if you don't dig into the details, using the compositions package version of the plots may be realtively easy to do,interpretable, and revealing -- more so than my simple but wrong suggestions. You can decide. I would not trust inference using ad hoc approaches in the untransformed data. That's what the package is for. But plotting the data should always be at least the first thing you do anyway. I often find it to be sufficient, too. Thank you for your suggestions on plotting, I will look into it. I was using histograms of mean proportions + SE until now because it was what seemed the most straightforward given my specific questions. If we come back to my original data (abandoning the statistical language for a while ;) ) I have proportions of fishes caught 1. near the surface, 2. a bit below, 5. near the bottom. The questions I want to ask are for example: does the vertical distribution of species A and species B differ? So I can plot the mean proportion at each depth for both species and obtain a visual representation of the vertical distribution of each. At this stage differences between fishes that accumulate near the surface or near the bottom are quite obvious. If I add error bars I can get an idea of the variability of those distributions. The issue arise when I want to *test* for a difference between the distributions of species A and B. If I use a basic KS test I can only compare the mean proportions for species A (5 points) to the mean proportions of species B (5 points) and this has low power + does not take in account the variability around those means. In addition I may also want to know wether there is a difference within species A, B and C and pairwise KS tests would increase alpha error risk. Am I explaining things correctly? Does this seem logical to you too? As for the PCA I must admit I don't really understand what you mean. Thank you very much again. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jiho Subject: Re: [R] Comparing multiple distributions Nobody answered my first request. I am sorry if I did not explain my problem clearly. English is not my native language and statistical english is even more difficult. I'll try to summarize my issue in more appropriate statistical terms: Each of my observations is not a single number but a vector of 5 proportions (which add up to 1 for each observation). I want to compare the shape of those vectors between two treatments (i.e. how the quantities are distributed between the 5 values in treatment A with respect to treatment B). I was pointed to Hotelling T-squared. Does it seem appropriate? Are there other possibilities (I read many discussions about hotelling vs. manova but I could not see how any of those related to my particular case)? Thank you very much in advance for your insights. See below for my earlier, more detailed, e-mail. On 2007-May-21 , at 19:26 , jiho wrote: I am studying the vertical distribution of plankton and want to study its variations relatively to several factors (time of day, species, water column structure etc.). So my data is special in that, at each sampling site (each observation), I don't have *one* number, I have *several* numbers (abundance of organisms in each depth bin, I sample 5 depth bins) which describe a vertical distribution. Then let say I want to compare speciesA with speciesB, I would end up trying to compare a group of several distributions with another group of several distributions (where a distribution is a vector of 5 numbers: an abundance for each depth bin). Does anyone know how I could do this (with R obviously ;) )? Currently I kind of get around the problem and: - compute mean abundance per depth bin within each group and compare the two mean distributions with a ks.test but this obviously diminishes the power of the test (I only compare

### [R] Restoring .Random.seed

Hi. Suppose I have a function which does some random number generation within. The random number generation inside the function changes the value of .Random.seed in the calling environment. If I want to restore the pre-function call .Random.seed, I can do: save.seed-.Random.seed result-myfunction() .Random.seed-save.seed Is there a way to do the restoration inside the function? I tried putting the save.seed-.Random.seed and .Random.seed-save.seed statements inside the function, but that didn't work. Perhaps there's some clever way to use environment() functions? (I confess I still haven't grasped those very well.) Also, the help section on .Random.seed mentions that some of the random number generators save their state differently. Does each random generation method have a way to restore its state? Thanks! -- TMK -- 212-460-5430home 917-656-5351cell __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Conditional logistic regression for events/trials format

Thanks for your reply Charles. I do indeed have other variables. I apologize for being vague, here is my study in more detail: I have a cohort of births. My outcome is a dichotomous variable for presence/absence of a birth defect. For each cohort member I estimate the date of conception, and assign a pollution level during the relevant period of gestation. All cohort members conceived on the same day are assigned the same pollution level. These cohort members also have a covariate, t, which indicates the day of follow-up. For example, if the first day of my study is Jan 1, 1987, the data would look like: Datet Conceptions Cases Pollution Stratum Jan 1, 1987 1 100 1 10 1 Jan 2, 1987 2 105 0 8 2 Jan 3, 1987 3 101 1 11 3 . . Jan 1, 1988 366 109 1 13 1 Jan 2, 1988 367 111 2 19 2 Jan 3, 1988 368 103 0 14 3 . . . I make matched pairs of days (Strata) to control for the influence of season. I also want to account for long-term trends, eg increasing birth defects ascertainment and decreasing pollution levels over time, so I want to fit a cubic spline using the variable t. I have already analyzed this data as a time series (I don't use the Stratum variable in the time-series analyses), but now I am exploring some alternatives. My full dataset has 3,115 strata. So my final model would look like: clogit(Cases/Conceptions ~ Pollution + f(t) + strata(Stratum)). So, just to reiterate, my goal is to make this model without having to bring in the individual-level data. I would be just as happy to do a conditional Poisson as I would be to do a conditional logistic regression - either would seem to be appropriate here - if that opens up some other options. Thanks very much for your time and interest, Matt Strickland Epidemiologist Birth Defects Branch U.S. Centers for Disease Control and Prevention -Original Message- From: Charles C. Berry [mailto:[EMAIL PROTECTED] Sent: Thursday, May 31, 2007 1:12 PM To: Strickland, Matthew (CDC/CCHP/NCBDDD) (CTR) Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED] Subject: Re: [R] Conditional logistic regression for events/trials format On Thu, 31 May 2007, Strickland, Matthew (CDC/CCHP/NCBDDD) (CTR) wrote: Dear R users, I have a large individual-level dataset (~700,000 records) which I am performing a conditional logistic regression on. Key variables include the dichotomous outcome, dichotomous exposure, and the stratum to which each person belongs. Using this individual-level dataset I can successfully use clogit to create the model I want. However reading this large .csv file into R and running the models takes a fair amount of time. Alternatively, I could choose to collapse the dataset so that each row has the number of events, number of individuals, and the exposure and stratum. In SAS they call this the events/trials format. This would make my dataset much smaller and presumably speed things up. I think you have described the data for forming a 2 by 2 by K table of counts. In which case, loglin(), loglm(), mantelhaen.test(), and - if K is not too large - glm(... , family=poisson) would be suitable. But you say 'models' above suggesting that there are some other variables. If so, you need to be a bit more specific in describing your setup. So my question is: can I use clogit (or possibly another function) to perform a conditional logistic regression when the data is in this events/trials format? I am using R version 2.5.0. Thank you very much, Matt Strickland Birth Defects Branch U.S. Centers for Disease Control __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Accessing plots in Trellis graphics

On 5/31/07, Vladimir Eremeev [EMAIL PROTECTED] wrote: I used similar empty space to place the legend, by specifying the placement coordinates to the key argument of xyplot. This was rather long time ago, and I had to explicitly form the list, used as the key argument for this function. Lattice has evolved since that, some automation has appeared. Try also using panel.identify, trellis.focus and other functions, listed on the help page together with these two. Another option is using page, as in this example from ?splom: splom(~iris[1:3]|Species, data = iris, layout=c(2,2), pscales = 0, varnames = c(Sepal\nLength, Sepal\nWidth, Petal\nLength), page = function(...) { ltext(x = seq(.6, .8, len = 4), y = seq(.9, .6, len = 4), lab = c(Three, Varieties, of, Iris), cex = 2) }) -Deepayan Sigbert Klinke wrote: I used xyplot to create conditional scatterplots. My layout is 5x3 plots, but my data contains only 14 subgroups. So I would like to use the empty plot to display additional information about the data. How can I access the plot? -- View this message in context: http://www.nabble.com/Accessing-plots-in-Trellis-graphics-tf3845949.html#a10892051 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] sd with n not n-1

need a version of sd [or var] to return population standard deviation (using n rather than n-1 denominator) that will operate on a dataframe containing missings, i.e. unequal n's. any ideas? thx, ted. Ted (Edwin) Blew [EMAIL PROTECTED] -- This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. -- [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] (no subject)

need a version of sd [or var] to return population standard deviation (using n rather than n-1 denominator) that will operate on a dataframe containing missings, i.e. unequal n's. any ideas? thx, ted. Ted (Edwin) Blew [EMAIL PROTECTED] -- This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] sd with n not n-1

need a version of sd [or var] to return population standard deviation (using n rather than n-1 denominator) that will operate on a dataframe containing missings, i.e. unequal n's. any ideas? thx, ted. Ted (Edwin) Blew [EMAIL PROTECTED] -- This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] sd with n not n-1

Ted, This is pretty simple. If you are new to programming with R, please read the Introduction to R at http://cran.r-project.org/doc/manuals/R-intro.html This will answer most of the basic questions, but it requires more time than typing out an email. If you still have questions, please 1. Read the posting guide when writing your message. 2. Provide a specific question rather than asking us to do the work for you. What part of this are you stuck on? We are happy to *help*, but you will have to do more. What you need is probably a few lines of code, but we try to encourage people to think about the solution a bit so that they don't email the list with every question that they have. Thanks, Max -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Blew, Ted Sent: Thursday, May 31, 2007 2:44 PM To: r-help@stat.math.ethz.ch Subject: [R] sd with n not n-1 need a version of sd [or var] to return population standard deviation (using n rather than n-1 denominator) that will operate on a dataframe containing missings, i.e. unequal n's. any ideas? thx, ted. -- LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Partially reading a file (particularly)

This is perfect, thanks for the help. The read-in time for one of these files alone (of 30+) on this machine improves from about 2:30 to 0:10 when using this method. -- jared tobin, student research assistant dept. of fisheries and oceans [EMAIL PROTECTED] -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Thursday, May 31, 2007 10:46 AM To: Tobin, Jared Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Partially reading a file (particularly) Try this: con - pipe(findstr /b 5 myfile.dat) open(con, r) DF - read.fwf(con, widths = c(1, 1, 2)) # replace with right args close(con) On 5/31/07, Tobin, Jared [EMAIL PROTECTED] wrote: The responses are much appreciated, thanks. findstr works and saves a lot of time. I didn't however have much success with that exact code persay; I get an error message that I don't understand, as follows: c1 - read.fwf(pipe(findstr /b 5 my.file), ...) Error in readLines(con, n, ok, warn, encoding) : 'con' is not a connection Error in close(file) : no applicable method for close I did however have success with pipe using readLines, albeit in a very clumsy fashion: c1 - readLines(pipe(findstr /b 5 my.file)) write(c1, file=temp.dat) t1 - read.fwf(temp.dat, ...) Do you receive the same error message as above when using pipe with read.fwf? -- jared tobin, student research assistant dept. of fisheries and oceans [EMAIL PROTECTED] -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 10:51 PM To: Charles C. Berry Cc: Tobin, Jared; r-help@stat.math.ethz.ch Subject: Re: [R] Partially reading a file (particularly) On 5/29/07, Charles C. Berry [EMAIL PROTECTED] wrote: On windows XP we can also use findstr which comes with Windows: res - read.fwf( pipe( findstr /b 5 my.file ) , other args ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Thanks for the input. I don't think this will help either since it still requires you know the error occurred in foo. I settled on passing the call to error: error - function(..., call) {} foo - function() error(some error, call = match.call()) Thanks, --sundar Martin Morgan said the following on 5/31/2007 7:51 AM: Hi sundar -- maybe myerr - function(err) err$call foo - function() stop() tryCatch({ foo() }, error=myerr) foo() suggests a way to catch errors without having to change existing code or re-invent stop? Martin Sundar Dorai-Raj [EMAIL PROTECTED] writes: Hi, Vladimir, Sorry, didn't see this reply. .Traceback - NULL doesn't work because of the warning in ?traceback. Warning: It is undocumented where '.Traceback' is stored nor that it is visible, and this is subject to change. Prior to R 2.4.0 it was stored in the workspace, but no longer. Thanks, --sundar Vladimir Eremeev said the following on 5/31/2007 5:10 AM: Vladimir Eremeev wrote: Does tail(capture.output(traceback()),n=1) do what you want? that is Hmmm... Seems, no... Having the earlier error() definition and bar-function() error(asdasdf) ft-function() bar() ft() I get in the tcl/tk window: Error in bar(): asdasdf bar() I get in the tcl/tk window: Error in ft(): asdasdf I get in the tcl/tk window: Error in bar(): asdasdf Some kind of the stack flushing is needed. .Traceback-NULL did not help __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Hi, On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } as.character(sys.call(-1)[[1]]) works for me. Best... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Thanks! That's the answer I was looking for. --sundar Ismail Onur Filiz said the following on 5/31/2007 12:23 PM: Hi, On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } as.character(sys.call(-1)[[1]]) works for me. Best... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] RODBC query

As a newbie to RODBC (Windows XP), I find that the commands aren't working quite as expected. After Library(RODBC) I had planned to use the two-step process myConn = odbcConnectExcel(Dates.xls) sqlQuery(myConn,SELECT ID, ADM_DATE, ADM_TIME FROM A) #A is the Excel spreadsheet name X = sqlGetResults(myConn, as.is=c(T,T,F)) #2 char variables and 1 integer odbcClose(myConn) This doesn't work. Instead the following works: myConn = odbcConnectExcel(Dates.xls) X=sqlQuery(myConn,SELECT ID, ADM_DATE, ADM_TIME FROM A, as.is=c(T,T,F)) odbcClose(myConn) class(X) [1] data.frame class(X$ID) [1] character class(X[,2]) [1] character class(X[,3]) [1] integer I thought sqlQuery stored a query that was to be processed by sqlGetResults. What's happening here? Joe __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Merging two data objects question

I have two R objects, allDataSubset1 and allDataSubset2 and the str of both of them is shown below ( I don't show all 18 lists for space purposes ). The difference between them is that the times ( and possibly the days ) and the data is different and what I want to do is merge them so that only the data in Subset2 that is the same day and times as Subset 1 remains in the merged dataset. Obviously the column names of Subset2 would have to changed to AUDB, CADB, CHFB etc when they were merged ? I have no idea how to do this and originally these 2 lists come from a zoo object so , if it's easier to merge the zoo objects and then do the creation of the lists, that's okay also but I don't know how to do that either. So, if someone wants me to send the the str of the zoo objects, I can do that also. Thanks so much for any help on this. It seems really complicated to me and I looked up merge but it said that it works off of data frames ? Maybe I need to put them in a data frame but with all these lists of lists etc, I'm totally clueless on how to do that. [1] STR OF allDataSubset1 List of 18 $ 20050101: num [1:2565, 1:7] 20050103 20050103 20050103 20050103 20050103 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:2565] 2005-01-03 08:04:00 2005-01-03 08:08:00 2005-01-03 08:12:00 2005-01-03 08:16:00 ... $ 20050201: num [1:2430, 1:7] 20050201 20050201 20050201 20050201 20050201 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:2430] 2005-02-01 08:04:00 2005-02-01 08:08:00 2005-02-01 08:12:00 2005-02-01 08:16:00 ... $ 20050301: num [1:2970, 1:7] 20050301 20050301 20050301 20050301 20050301 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:2970] 2005-03-01 08:04:00 2005-03-01 08:08:00 2005-03-01 08:12:00 2005-03-01 08:16:00 ... $ 20050401: num [1:2835, 1:7] 20050401 20050401 20050401 20050401 20050401 ... #=== = List of 18 $ 20050101: num [1:10260, 1:7] 20050103 20050103 20050103 20050103 20050103 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:10260] 2005-01-03 08:01:00 2005-01-03 08:02:00 2005-01-03 08:03:00 2005-01-03 08:04:00 ... $ 20050201: num [1:9720, 1:7] 20050201 20050201 20050201 20050201 20050201 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:9720] 2005-02-01 08:01:00 2005-02-01 08:02:00 2005-02-01 08:03:00 2005-02-01 08:04:00 ... $ 20050301: num [1:11880, 1:7] 20050301 20050301 20050301 20050301 20050301 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:11880] 2005-03-01 08:01:00 2005-03-01 08:02:00 2005-03-01 08:03:00 2005-03-01 08:04:00 ... $ 20050401: num [1:11340, 1:7] 20050401 20050401 20050401 20050401 20050401 ... ..- attr(*, dimnames)=List of 2 .. ..$ : NULL .. ..$ : chr [1:7] filedate AUD CAD CHF ... ..- attr(*, index)='POSIXct', format: chr [1:11340] 2005-04-01 08:01:00 2005-04-01 08:02:00 2005-04-01 08:03:00 2005-04-01 08:04:00 ... This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Aggregate to find majority level of a factor

I want to use the aggregate function to summarize data by a factor (my field plots), but I want the summary to be the majority level of another factor. For example, given the dataframe: Plot1 big Plot1 big Plot1 small Plot2 big Plot2 small Plot2 small Plot3 small Plot3 small Plot3 small My desired result would be: Plot1 big Plot2 small Plot3 small I can't seem to find a scalar function that will give me the majority level. Thanks in advance, Jonathan Thompson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Restoring .Random.seed

On Thu, 31 May 2007, Talbot Katz wrote: Hi. Suppose I have a function which does some random number generation within. The random number generation inside the function changes the value of .Random.seed in the calling environment. If I want to restore the ^^ That is your misunderstanding. From the help page The object '.Random.seed' is only looked for in the user's workspace. which seems plain enough. So, you can do save.seed - get(.Random.seed, .GlobalEnv) assign(.Randon.seed, save.seed, .GlobalEnv) to save and restore, *provided* that random numbers have been used in the session (or .Random.seed will not exist). However, the help recommends using set.seed(), and why not follow the advice? pre-function call .Random.seed, I can do: save.seed-.Random.seed result-myfunction() .Random.seed-save.seed Is there a way to do the restoration inside the function? I tried putting the save.seed-.Random.seed and .Random.seed-save.seed statements inside the function, but that didn't work. As documented on the help page. [...] -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] determining a parent function name

Sorry for replying to myself, but: On Thursday 31 May 2007 12:23:12 Ismail Onur Filiz wrote: Hi, On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } as.character(sys.call(-1)[[1]]) works for me. you can furthermore do: options(error=error) and remove the stop(msg) call in the last line of the function. Then your function will become the error handler. Best... Best... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] R's Spearman

Dear Ray, The R's Spearman calculated by R is correct for ties or nonties, which is not correct is the probability for the case of ties. I send to you formulates it for the correlation with ties, that is equal to R. Regards, Felipe de Mendiburu Statistician # Spearman correlation rs with ties or no ties rs-function(x,y) { d-rank(x)-rank(y) tx-as.numeric(table(x)) ty-as.numeric(table(y)) Lx-sum((tx^3-tx)/12) Ly-sum((ty^3-ty)/12) N-length(x) SX2- (N^3-N)/12 - Lx SY2- (N^3-N)/12 - Ly rs- (SX2+SY2-sum(d^2))/(2*sqrt(SX2*SY2)) return(rs) } # Aplicacion cor(y[,1],y[,2],method=spearman) [1] 0.2319084 rs(y[,1],y[,2]) [1] 0.2319084 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Raymond Wan Sent: Monday, May 28, 2007 10:29 PM To: r-help@stat.math.ethz.ch Subject: [R] R's Spearman Hi all, I am trying to figure out the formula used by R's Spearman rho (using cor(method=spearman)) because I can't seem to get the same value as by calculating by hand. Perhaps I'm using cor wrong, but I don't know where. Basically, I am running these commands: y=read.table(file=tmp,header=TRUE,sep=\t) y IQ Hours 1 106 7 2 86 0 3 9720 4 11312 5 12012 6 11017 cor(y[1],y[2],method=spearman) Hours IQ 0.2319084 [it's an abbreviated example of one I took from Wikipedia]. I calculated by hand (apologies if the table looks strange when pasted into e-mail): IQHoursrank(IQ) rank(hours)diffdiff^2 110673 2 11 2 8601 1 00 3 9720 2 6-416 411312 5 3.5 1.52.25 512012 6 3.5 2.56.25 611017 4 5-11 26.5 rho=0.242857 where rho = (1 - ((6 * 26.5) / 6 * (6^2 - 1))). I kept modifying the table and realized that the difference in result comes from ties. i.e., if I remove the tie in rows 4 and 5, I get the same result from both cor and calculating by hand. Perhaps I'm handling ties wrong...does anyone know how R does it or perhaps I need to change how I'm using it? Thank you! Ray __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Aggregate to find majority level of a factor

How about tapply? plot - gl(2,3); plot type - letters[c(1,2,2,1,1,1)]; type tapply(type, list(plot), function(x) {tabl - table(x) names(tabl[tabl==max (tabl)])}) Hank On May 31, 2007, at 3:25 PM, Thompson, Jonathan wrote: I want to use the aggregate function to summarize data by a factor (my field plots), but I want the summary to be the majority level of another factor. For example, given the dataframe: Plot1 big Plot1 big Plot1 small Plot2 big Plot2 small Plot2 small Plot3 small Plot3 small Plot3 small My desired result would be: Plot1 big Plot2 small Plot3 small I can't seem to find a scalar function that will give me the majority level. Thanks in advance, Jonathan Thompson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Dr. Hank Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Follow up: surfaces and digital terrain model

I realize that as of yesterday, this message thread is 4 years old but can someone possibly post the clines function that Renaud mentions in the posting below? That would be wonderful and most appreciated. Thanks, Andrew Andrew Niccolai Doctoral Candidate Yale School of Forestry From: Renaud Lancelot lancelot Date: Fri May 30 22:37:02 2003 Yesterday, I posted the following: I have computed a digital terrain model from a set of points (x, y, z) using the function interp() in package akima. I want to predict flooded surfaces given target values of z. I can display the flooded surfaces with contour() or image(), but I don't know how to get the polygons delimiting the surfaces. Did anyone write a function for this purpose ? Many thanks to Roger Bivand, Paul Murrel, Deepayan Sarkar, Barry Rowlingson and Thomas W Blackwell for their replies and their help. Paul Murrel provided me with a function clines, kindly ported to Windows by Duncan Murdoch. This function does exactly what I need, i.e. it returns a list of polygons corresponding to target value(s) of z. I wrote a function to compute (hopefully !) what I want, i.e. predicted flooded surfaces given target values of z (managing the cases of several independent watered surfaces, possibly with islands). Provided that Paul Murrel agrees to share his function, I will be happy to send it to anyone wishing to use and improve it (and debug it ;-) ). Best regards and thanks again, Renaud -- Dr Renaud Lancelot, v?t?rinaire CIRAD, D?partement Elevage et M?decine V?t?rinaire (CIRAD-Emvt) Programme Productions Animales http://www.cirad.fr/fr/pg_recherche/page.php?id=14 ISRA-LNERV tel+221 832 49 02 BP 2057 Dakar-Hann fax+221 821 18 79 (CIRAD) Senegal e-mail renaud.lancelot_at_cirad.fr __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Aggregate to find majority level of a factor

On Thu, 2007-05-31 at 12:25 -0700, Thompson, Jonathan wrote: I want to use the aggregate function to summarize data by a factor (my field plots), but I want the summary to be the majority level of another factor. For example, given the dataframe: Plot1 big Plot1 big Plot1 small Plot2 big Plot2 small Plot2 small Plot3 small Plot3 small Plot3 small My desired result would be: Plot1 big Plot2 small Plot3 small I can't seem to find a scalar function that will give me the majority level. Thanks in advance, Jonathan Thompson Jonathan, Try this: DF V1V2 1 Plot1 big 2 Plot1 big 3 Plot1 small 4 Plot2 big 5 Plot2 small 6 Plot2 small 7 Plot3 small 8 Plot3 small 9 Plot3 small with(DF, aggregate(V2, list(V1), function(x) names(which.max(table(x) Group.1 x 1 Plot1 big 2 Plot2 small 3 Plot3 small See ?which.max, ?names and ?table. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Aggregate to find majority level of a factor

Jon One way: assuming your data.frame is 'jon' aggregate(jon[,2], list(jon[,1]), function(x) levels(x)[which.max(table(x))]) Group.1 x 1 Plot1 big 2 Plot2 small 3 Plot3 small HTH Peter Alspach -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thompson, Jonathan Sent: Friday, 1 June 2007 7:26 a.m. To: r-help@stat.math.ethz.ch Subject: [R] Aggregate to find majority level of a factor I want to use the aggregate function to summarize data by a factor (my field plots), but I want the summary to be the majority level of another factor. For example, given the dataframe: Plot1 big Plot1 big Plot1 small Plot2 big Plot2 small Plot2 small Plot3 small Plot3 small Plot3 small My desired result would be: Plot1 big Plot2 small Plot3 small I can't seem to find a scalar function that will give me the majority level. Thanks in advance, Jonathan Thompson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ The contents of this e-mail are privileged and/or confidenti...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Restoring .Random.seed

Thanks! The get / assign combination does just what I want, and the warning about the pre-existence of .Random.seed was very helpful. As for set.seed, I have used it to create a replicable state (in fact, I have an option to use it in the function I was writing that prompted my query), but I didn't see any indication that it could be used to restore a state for which you don't necessarily know the seed. I got a couple of good offlist responses, too. One person told me about the - assignment operator (with an admonishment to use it judiciously). Another responder mentioned the setRNG package, which has a specific methodology for saving the random number generator state. -- TMK -- 212-460-5430home 917-656-5351cell From: Prof Brian Ripley [EMAIL PROTECTED] To: Talbot Katz [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] Restoring .Random.seed Date: Thu, 31 May 2007 20:57:09 +0100 (BST) On Thu, 31 May 2007, Talbot Katz wrote: Hi. Suppose I have a function which does some random number generation within. The random number generation inside the function changes the value of .Random.seed in the calling environment. If I want to restore the ^^ That is your misunderstanding. From the help page The object '.Random.seed' is only looked for in the user's workspace. which seems plain enough. So, you can do save.seed - get(.Random.seed, .GlobalEnv) assign(.Randon.seed, save.seed, .GlobalEnv) to save and restore, *provided* that random numbers have been used in the session (or .Random.seed will not exist). However, the help recommends using set.seed(), and why not follow the advice? pre-function call .Random.seed, I can do: save.seed-.Random.seed result-myfunction() .Random.seed-save.seed Is there a way to do the restoration inside the function? I tried putting the save.seed-.Random.seed and .Random.seed-save.seed statements inside the function, but that didn't work. As documented on the help page. [...] -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] Aggregate to find majority level of a factor

This should do the trick. Also labels ties with NA. a=as.data.frame(cbind(c(1,1,1,2,2,2,3,3,3,4,4),c ('big','big','small','big','small','small','small','small','small','big' ,'small'))) a$V2=factor(a$V2) maj=function(x){ y=table(x) z=which.max(y) if(sum(y==max(y))==1){ return(names(y)[z]) }else{ return(NA) } } aggregate(a$V2,list(a$V1),maj) On 31-May-07, at 4:25 PM, Thompson, Jonathan wrote: I want to use the aggregate function to summarize data by a factor (my field plots), but I want the summary to be the majority level of another factor. For example, given the dataframe: Plot1 big Plot1 big Plot1 small Plot2 big Plot2 small Plot2 small Plot3 small Plot3 small Plot3 small My desired result would be: Plot1 big Plot2 small Plot3 small I can't seem to find a scalar function that will give me the majority level. Thanks in advance, Jonathan Thompson __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Mac OS X crash bug?

Hi all, I want to check if this is a bug for which I should file a report. I am using R2.5.0 on OS X 10.4.9. When I invoke the data editor and when I change the values of individual cells, it seems to work as intended. However, when I try to delete/add a row/column, R.app crashes. I've attached the crash log. Best, -Nathan Date/Time: 2007-05-31 17:13:26.370 -0400 OS Version: 10.4.9 (Build 8P135) Report Version: 4 Command: R Path:/Applications/R.app/Contents/MacOS/R Parent: WindowServer [89] Version: R 2.5.0 GUI 1.19 (4308) PID:4001 Thread: 0 Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x Thread 0 Crashed: 0 libR.dylib 0x010c0b80 SET_STRING_ELT + 96 (memory.c:2619) 1 org.R-project.R 0x0001d968 -[REditor addRow:] + 452 2 com.apple.AppKit0x9394558c -[NSToolbarButton sendAction:to:] + 76 3 com.apple.AppKit0x9394552c -[NSToolbarButton sendAction] + 80 4 com.apple.AppKit0x93944e84 -[NSToolbarItemViewer mouseDown:] + 1568 5 com.apple.AppKit0x937d9890 -[NSWindow sendEvent:] + 4616 6 com.apple.AppKit0x937828d4 -[NSApplication sendEvent:] + 4172 7 com.apple.AppKit0x9392a2dc -[NSApplication _modalSession:sendEvent:] + 440 8 com.apple.AppKit0x939288fc -[NSApplication _realDoModalLoop:peek:] + 296 9 com.apple.AppKit0x9391f2b0 -[NSApplication runModalForWindow:] + 176 10 org.R-project.R 0x0001db28 +[REditor startDataEntry] + 216 11 org.R-project.R 0xe2dc Re_dataentry + 1168 12 libR.dylib 0x010d02e0 do_internal + 432 (names.c:1123) 13 libR.dylib 0x0109c7a8 Rf_eval + 1224 (eval.c:444) 14 libR.dylib 0x0109e874 do_set + 436 (eval.c:1389) 15 libR.dylib 0x0109c7a8 Rf_eval + 1224 (eval.c:444) 16 libR.dylib 0x0109eb1c do_begin + 140 (eval.c:1125) 17 libR.dylib 0x0109c7a8 Rf_eval + 1224 (eval.c:444) 18 libR.dylib 0x010a0128 Rf_applyClosure + 1016 (eval.c:634) 19 libR.dylib 0x010d3338 Rf_usemethod + 2120 (objects.c:310) 20 libR.dylib 0x010d36c0 do_usemethod + 800 (objects.c:394) 21 libR.dylib 0x0109c7a8 Rf_eval + 1224 (eval.c:444) 22 libR.dylib 0x010a0128 Rf_applyClosure + 1016 (eval.c:634) 23 libR.dylib 0x0109c990 Rf_eval + 1712 (eval.c:475) 24 libR.dylib 0x0109e874 do_set + 436 (eval.c:1389) 25 libR.dylib 0x0109c7a8 Rf_eval + 1224 (eval.c:444) 26 libR.dylib 0x010598d0 protectedEval + 64 (context.c:636) 27 libR.dylib 0x01059840 R_ToplevelExec + 208 (context.c:593) 28 libR.dylib 0x0105992c R_tryEval + 60 (context.c:649) 29 org.R-project.R 0xf954 -[REngine evaluateExpressions:] + 176 30 org.R-project.R 0xfd20 -[REngine executeString:] + 204 31 org.R-project.R 0x0001b8d8 -[WSBrowser editObject:] + 176 32 com.apple.AppKit0x9394558c -[NSToolbarButton sendAction:to:] + 76 33 com.apple.AppKit0x9394552c -[NSToolbarButton sendAction] + 80 34 com.apple.AppKit0x93944e84 -[NSToolbarItemViewer mouseDown:] + 1568 35 com.apple.AppKit0x937d9890 -[NSWindow sendEvent:] + 4616 36 com.apple.AppKit0x937828d4 -[NSApplication sendEvent:] + 4172 37 org.R-project.R 0x58cc -[RController handleReadConsole:] + 84 38 org.R-project.R 0xca6c Re_ReadConsole + 100 39 org.R-project.R 0x00016bbc run_REngineRmainloop + 296 40 org.R-project.R 0xf670 -[REngine runREPL] + 68 41 org.R-project.R 0x2e20 main + 816 42 org.R-project.R 0x2a74 _start + 760 43 org.R-project.R 0x2778 start + 48 Thread 1: 0 libSystem.B.dylib 0x9001f98c select + 12 1 org.R-project.R 0x4788 -[RController readThread:] + 588 2 com.apple.Foundation0x92be11a0 forkThreadForFunction + 108 3 libSystem.B.dylib 0x9002be08 _pthread_body + 96 Thread 2: 0 libSystem.B.dylib 0x9004a768 syscall_thread_switch + 8 1 com.apple.Foundation0x92bf95dc +[NSThread sleepUntilDate:] + 152 2 com.apple.AppKit0x9381aa10 -[NSUIHeartBeat _heartBeatThread:] + 1100 3 com.apple.Foundation0x92be11a0 forkThreadForFunction + 108 4 libSystem.B.dylib 0x9002be08 _pthread_body + 96 Thread 0 crashed with PPC Thread State 64: srr0: 0x010c0b80 srr1: 0x0200f030 vrsave: 0x cr: 0x24024282 xer: 0x0004 lr: 0x010c0b34 ctr: 0x010c0b20 r0: 0x8000 r1: 0xbfffb660 r2: 0x8000 r3:

### Re: [R] determining a parent function name

Ismail Onur Filiz said the following on 5/31/2007 1:03 PM: Sorry for replying to myself, but: On Thursday 31 May 2007 12:23:12 Ismail Onur Filiz wrote: Hi, On Wednesday 30 May 2007 14:53:28 Sundar Dorai-Raj wrote: error - function(...) { msg - paste(..., sep = ) if(!length(msg)) msg - if(require(tcltk, quiet = TRUE)) { tt - tktoplevel() tkwm.title(tt, Error) tkmsg - tktext(tt, bg = white) tkinsert(tkmsg, end, sprintf(Error in %s: %s, ???, msg)) tkconfigure(tkmsg, state = disabled, font = Tahoma 12, width = 50, height = 3) tkpack(tkmsg, side = bottom, fill = y) } stop(msg) } as.character(sys.call(-1)[[1]]) works for me. you can furthermore do: options(error=error) and remove the stop(msg) call in the last line of the function. Then your function will become the error handler. Best... Thanks, with the minor change to sys.call(-2) that does exactly what I want. thanks, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] RODBC query

On Thu, 31 May 2007, Lucke, Joseph F wrote: As a newbie to RODBC (Windows XP), I find that the commands aren't working quite as expected. After Library(RODBC) I had planned to use the two-step process myConn = odbcConnectExcel(Dates.xls) sqlQuery(myConn,SELECT ID, ADM_DATE, ADM_TIME FROM A) #A is the Excel spreadsheet name X = sqlGetResults(myConn, as.is=c(T,T,F)) #2 char variables and 1 integer odbcClose(myConn) This doesn't work. Instead the following works: myConn = odbcConnectExcel(Dates.xls) X=sqlQuery(myConn,SELECT ID, ADM_DATE, ADM_TIME FROM A, as.is=c(T,T,F)) odbcClose(myConn) class(X) [1] data.frame class(X$ID) [1] character class(X[,2]) [1] character class(X[,3]) [1] integer I thought sqlQuery stored a query that was to be processed by sqlGetResults. What's happening here? Listing the function shows sqlQuery function (channel, query, errors = TRUE, ..., rows_at_time = 1) { if (!odbcValidChannel(channel)) stop(first argument is not an open RODBC channel) if (missing(query)) stop(missing parameter) stat - odbcQuery(channel, query, rows_at_time) if (stat == -1) { if (errors) return(odbcGetErrMsg(channel)) else return(stat) } else return(sqlGetResults(channel, errors = errors, ...)) } It is odbcQuery that runs the query alone. -- 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-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] Clines library

I truly apologize, I just found the clines package. Thanks. Andrew Niccolai Doctoral Candidate Yale School of Forestry __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### [R] R keeps crashing when executing 'rlogspline'

Dear List, I have a simple model as follows: x - rnorm(500) library(logspline) fit - logspline(x) n - 100 y - replicate(n, sum(rlogspline(rpois(1,10), fit))) # last line The problem I keep getting is R crashes when doing the last line. It seems to be fine if n is small, but not if n is 100. The message I keep getting is: R for Windows GUI front-end has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost. Any insights would be appreciated, Jacques platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 5.0 year 2007 month 04 day23 svn rev41293 language R version.string R version 2.5.0 (2007-04-23) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

### Re: [R] [R-sig-Geo] Clines library

You can now use contourLines in the grDevices package included with R. Hadley On 5/31/07, Andrew Niccolai [EMAIL PROTECTED] wrote: I truly apologize, I just found the clines package. Thanks. Andrew Niccolai Doctoral Candidate Yale School of Forestry ___ R-sig-Geo mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-sig-geo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.