### Re: [R] R Anova

Keizer_61 wrote: I am really struggling with this question. Three students take part of an experiment. student smoking non-smokingcancer 110.5 7.5 6.5 2 9.5 6.5 8.4 3 8.5 7.2 5.5 the proper inferences is .05 we need to conduct Anova and have a inference of .05. How do you enter this in R? How do you calculate the F-test using R for this if we have smoking, non-smoking and cancer all equal. any suggestions? Try to do the homework yourself and read the manuals? Uwe Ligges 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.

### [R] How to solve difficult equations?

This below is not solvable with uniroot to find a: fn=function(a){ b=(0.7/a)-a (1/(a+b+1))-0.0025 } uniroot(fn,c(-500,500)) gives Error in uniroot(fn, c(-500, 500)) : f() values at end points not of opposite sign I read R-help posts and someone wrote a function: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92407.html but it is not very precise. Is there any 'standard function in R that can solve this? thanks. -- View this message in context: http://www.nabble.com/How-to-solve-difficult-equations--tf3643595.html#a10175603 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] simulate values

Soare Marcian-Alin wrote: Hello, I want to simulate 100 values of the ARMA Process with this function: x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] + 0.3 * x[i-3] There is no kind of noise in your model, hence no need to do any simulation so far ... Uwe Ligges which possibilities do I have? Alin Soare [[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] How to solve difficult equations?

I don't see the problem, except that you might want to think about what the error message is telling you. A little exploration of your function always helps, too. ss - seq(-2, 2, len = 100) plot(ss, fn(ss), type = l) uniroot(fn, c(-1, 1)) Erreur dans uniroot(fn, c(-1, 1)) : f() values at end points not of opposite sign fn(-1) [1] 3.330833 fn(0) [1] -0.0025 fn(1) [1] 0.5857353 uniroot(fn, c(-1, 0)) $root [1] -0.6999466 $f.root [1] -13118.83 $iter [1] 18 $estim.prec [1] 7.70751e-05 uniroot(fn, c(0, 1)) $root [1] 0.001760625 $f.root [1] 8.86832e-06 $iter [1] 3 $estim.prec [1] 6.103516e-05 This below is not solvable with uniroot to find a: fn=function(a){ b=(0.7/a)-a (1/(a+b+1))-0.0025 } uniroot(fn,c(-500,500)) gives Error in uniroot(fn, c(-500, 500)) : f() values at end points not of opposite sign I read R-help posts and someone wrote a function: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92407.html but it is not very precise. Is there any 'standard function in R that can solve this? 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] Analysis of Variance

CrazyJoe wrote: Hello Blind toy_Car toy_truck toy_boat 1 6.3 7.5 5.4 2 3.4 8.1 6.1 3 2.2 4.4 5.1 How do we calculate the F-statistic in R. Any help is really appreciated. You may want to try to do the homework yourself and read the manuals... It also makes sense to specify the model rather than just providing some data. Uwe Ligges __ 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 solve difficult equations?

plot(fn,-1,1) could be helpful, hth, Ingmar On 25 Apr 2007, at 09:15, francogrex wrote: This below is not solvable with uniroot to find a: fn=function(a){ b=(0.7/a)-a (1/(a+b+1))-0.0025 } uniroot(fn,c(-500,500)) gives Error in uniroot(fn, c(-500, 500)) : f() values at end points not of opposite sign I read R-help posts and someone wrote a function: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92407.html but it is not very precise. Is there any 'standard function in R that can solve this? thanks. -- View this message in context: http://www.nabble.com/How-to-solve- difficult-equations--tf3643595.html#a10175603 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. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256735 [[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] simulate values

On Wed, 25 Apr 2007, Uwe Ligges wrote: Soare Marcian-Alin wrote: Hello, I want to simulate 100 values of the ARMA Process with this function: x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] + 0.3 * x[i-3] There is no kind of noise in your model, hence no need to do any simulation so far ... My guess is that ... x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] + 0.3 * x[i-3] was meant to be for a noise series z. In any case, to simulate an 'ARMA Process', see ?arima.sim. Uwe Ligges which possibilities do I have? Alin Soare [[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. -- 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] Unsubscription Confirmation

Thank you for subscribing. You have now unsubscribed and no more messages will be sent. __ 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] for loops

Hello everybody I'm very new at using R so probably this is a very stupid question. I have a matrix of p columns and I have to calculate for each of them the two sample t-statistic and p-value and to save the results into two different vectors. I have divided my matrix into two submatrices: submatrix A containing the first n1 rows (p columns) and submatrix B containing the remaining n2 (total rows=n1+n2). How can I do this with for loop construction? Friendly regards Silvia -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada __ 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 solve difficult equations?

On 25-Apr-07 07:15:55, francogrex wrote: This below is not solvable with uniroot to find a: fn=function(a){ b=(0.7/a)-a (1/(a+b+1))-0.0025 } uniroot(fn,c(-500,500)) gives Error in uniroot(fn, c(-500, 500)) : f() values at end points not of opposite sign I read R-help posts and someone wrote a function: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92407.html but it is not very precise. Is there any 'standard function in R that can solve this? thanks. Two answers: Yes, and No. First, No: Let alpha denote 0.0025, and beta 0.7 (in your function fn). Then fna - function(alpha,beta){ beta*alpha/(1 - alpha) } solves it. But this is not a standard R function. Second, Yes: and the standard R function is uniroot(). But you can only apply it usefully if you first study the behaviour of your function fn(), in rather careful detail. Over your range (-500,500): a-10*(-50:50) plot(a,fn(a),pch=+) Clearly something extreme happens just to the left of a=0. So: a - 0.025*(-100:0) plot(a,fn(a),pch=+) and so for this set of values of 'a' the previous behaviour cannot be seen. So: a - 0.01*(-100:100)+0.001 plot(a,fn(a),pch=+) so the function goes very negative somewhere around a = -0.7. But fn(500) [1] 0.996102 so it is positive for a=500. Now find (inspired by the latest plot): a[which(fn(a) (-100))] [1] -0.699 and now you can use uniroot: uniroot(fn,c(-0.699,500)) $root [1] 0.001771128 $f.root [1] 2.379763e-05 $iter [1] 16 $estim.prec [1] 6.103516e-05 and, if that doesn't look precise enough: uniroot(fn,c(-0.699,500),tol=1e-10) $root [1] 0.001754386 $f.root [1] 1.354602e-14 $iter [1] 18 $estim.prec [1] 5e-11 Now compare with the function fna() that solves it directly: fna(0.0025,0.7) [1] 0.001754386 (so in fact it was worth increasing the precision for uniroot). But the lesson to be drawn from all this is that for functions like fn(), which have singularities (here at a = -0.7), the blind application of root-finding functions may not work, since they are not set up to explore the function is the kind of way illustrated above. While there are procedures in the numerical analysis world to handle this kind of thing, they tend to be written for particular classes of function, and again you will have to do a bit of exploration to find out which function to use. And (while someone more knowledgeable may well disagree with me) I suspect that these are not standard R funnctions. Hoping this is helpful, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 25-Apr-07 Time: 09:31:29 -- XFMail -- __ 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] Permutations with samr

I have a question regarding the samr package. For a 2 class unpaired problem, with sample 1 of size N1 and sample 2 of size N2, samr computes at most (N1+N2)! permutations of the two samples (if the user-supplied parameter nperms allows it). However, there are only (N1+N2)/(N1!*N2!) DISTINCT permutations of the two samples, so it seems to me that only these distinct permutations should be taken into consideration. Of course, working with the (N1+N2)! permutations and working with the (N1+N2)/(N1!*N2!) distinct permutations will lead to the same correct result, but for a number of permutations smaller than (N1+N2)/(N1!*N2!), the result will generally be different. I would be very grateful if someone could provide me an explanation for the samr choice of the permutations. Thanks for your help, Isabelle Dr. Isabelle Rivals - Maître de Conférences Équipe de Statistique Appliquée - ESPCI 10 rue Vauquelin - 75231 PARIS Cedex 05 Tél : (00 33 1) 40 79 45 45 Fax : (00 33 1) 40 79 44 20 __ 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] omit y=zero line in histogram

Dear all, hist ( ) plots a horizontal line at y=0 when the respective bin is empty. I can deal with this by modifying the hist object before plotting it (x$density[x$density == 0] - NA), but I'm sure I've seen a more elegant way. Perhaps this was in truehist (MASS). I have looked but can't find it. Does anyone know? Best wishes Paul -- View this message in context: http://www.nabble.com/omit-y%3Dzero-line-in-histogram-tf3643983.html#a10176762 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] RE : for loops

You can see with this simple example. matrix.t.test-function(mx){ p-dim(mx)[2] #number of column in the matrix n-dim(mx)[1] #number of row n.tests- p*(p-1)/2 #Number of tests to be done tested.var -rep(,n.tests) #Keep rang of tested column r.t.stat-rep(0, n.tests)#contain t.stat r.p.val -rep(0, n.tests)#contain p.values ctst-1 #current test for (i in 1:(p-1)){ for (j in (i+1):p){ r.t.stat[ctst]-t.test(mx[,i],mx[,j])$statistic r.p.val [ctst] -t.test(mx[,i],mx[,j])$p.value tested.var [ctst]-paste(i,-,j) ctst-ctst+1 } } result-data.frame(tested.var,r.t.stat,r.p.val) return(result) } matrix.t.test(matrix(rnorm(50),nr=10,nc=5)) --- [EMAIL PROTECTED] [EMAIL PROTECTED] a écrit : Hello everybody I'm very new at using R so probably this is a very stupid question. I have a matrix of p columns and I have to calculate for each of them the two sample t-statistic and p-value and to save the results into two different vectors. I have divided my matrix into two submatrices: submatrix A containing the first n1 rows (p columns) and submatrix B containing the remaining n2 (total rows=n1+n2). How can I do this with for loop construction? Friendly regards Silvia -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada __ 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. Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. __ 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] correlation table

hello, is it possible to create a correlation table between factors? ___ [[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] unit testing frameworks for R

Greetings! After a quick look at current programming tools, especially with regards to unit-testing frameworks, I've started looking at both butler and RUnit. I would be grateful to receieve real world development experience and opinions with either/both.Please send to me directly (yes, this IS my work email), I will summarize (named or anonymous, as contributers desire) to the list. (work email used, as this is applicable to my work rather than usual hobbies for a change, and some people with good reason prefer truth in requesting). Best regards / Mit freundlichen Grüssen, Anthony (Tony) Rossini Novartis Pharma AG MODELING SIMULATION Group Head a.i., EU Statistical Modeling CHBS, WSJ-027.1.012 Novartis Pharma AG Lichtstrasse 35 CH-4056 Basel Switzerland Phone: +41 61 324 4186 Fax: +41 61 324 3039 Cell: +41 79 367 4557 Email : [EMAIL PROTECTED] [[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] attributable risk

Hi everybody, Does anyone know a function to compute the attributable risk of a factor in a logistic regression or a proportional hazard cox model (both with confounding variables)? I need also obtain the confidence interval. Thanks in advance. Isaac Subirana. La informaciÃ³ continguda en aquest missatge i en qualsevol fitxer adjunt Ã©s confidencial, privada i d'Ãºs exclusiu per al destinatari. Si no Ã©s la persona a la qual anava dirigida aquesta informaciÃ³, si us plau, notifiqui immediatament l'enviament erroni al remitent i esborri el missatge. Qualsevol cÃ²pia, divulgaciÃ³, distribuciÃ³ o utilitzaciÃ³ no autoritzada d'aquest correu electrÃ²nic i dels seus adjunts estÃ prohibida en virtut de la legislaciÃ³ vigent. La informaciÃ³n contenida en este mensaje y en cualquier fichero adjunto es confidencial, privada y de uso exclusivo para el destinatario. Si usted no es la persona a la cual iba dirigida esta informaciÃ³n, por favor, notifique inmediatamente el envÃo errÃ³neo al remitente y borre el mensaje. Cualquier copia, divulgaciÃ³n, distribuciÃ³n o utilizaciÃ³n no autorizada de este correo electrÃ³nico y de sus adjuntos estÃ¡ prohibida en virtud de la legislaciÃ³n vigente. The information included in this e-mail and any attached files are confidential and private. If you are not the intended recipient, please notify the error to the sender and delete this message immediately. Dissemination, forwarding or copying of this e-mail and its associated attachments is strictly prohibited according with current legislation. [[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] regular expressions with grep() and negative indexing

Dear R-helpers, Does anyone know how to use regular expressions to return vector elements that don't contain a word? For instance, if I have a vector x - c(seal.0,seal.1-exclude) I'd like to get back the elements which do not contain the word exclude, using something like (I know this doesn't work) but: grep([^(exclude)],x) I can use x[-grep(exclude,x)] for this case but then if I use this expression in a recursive function, it will not work for instances in which the vector contains no elements with that word. For instance, if I have x2 - c(dolphin.0,dolphin.1) then x2[-grep(exclude,x2)] will give me 'character(0)' I know I can accomplish this in several steps, for instance: myfunc - function(x) { iexclude - grep(exclude,x) if(length(iexclude) 0) x2 - x[-iexclude] else x2 - x # do stuff with x2 ...? } But this is embedded in a much larger function and I am trying to minimize intermediate variable assignment (perhaps a futile effort). But if anyone knows of an easy solution, I'd appreciate a tip. Thanks very much! Stephen __ 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 minimum spanning tree in graph/RBGL

I wonder if anyone could tell me how I can plot a Minimum Spanning Tree using the functions provided in the graph and RBGL packages? I am able to build the MST using the following set of commands: library(graph) library(RBGL) x - read.table(h:/pole.tab,header=T,row.names=1) y - dist(x) g1 - new(distGraph,y) g2 - mstree.kruskal(g1) However, there doesn't seem to be a function that allows the command plot(g2) to draw it. Many thanks, Andrew Wilson __ 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 with saptial analysis (cluster)

Hi R-users I'm a beginner with R and statistics, so I need some help to start my data analysis. I've been reading some docs and tutorials on R and cluster analysis. I've got a large dataset (102000 points) with values of longitude, latitude and temperature and want to see if I can find groups (clusters). Following some tutorials I can look for principal components but get an error with calculation of distances: matriz.distancias-dist(comp.obs) Error in vector(double, length) : specified vector size is too big (translated from spanish) So, my questions are: is the dataset too big? could you point me to any docs explaining how to study spatially distributed data (lon,lat,data)? Thanks in advance ___ Francisco Pastor Meteorology department Fundación CEAM [EMAIL PROTECTED] http://www.gva.es/ceamet http://www.gva.es/ceam Paterna, Valencia, Spain ___ Usuario Linux registrado: 363952 __ 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] Problem installing Rmpi with lam on SGI SLES9

On 24/04/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Tue, 24 Apr 2007, Hendrik Fuß wrote: Hi, I've been trying here to install Rmpi on an SGI IA-64 machine with 64 processors, running SuSE Linux Enterprise Server 9, R 2.4.0 and lam-mpi 7.1.3. While I've read of similar problems on this list, I think I've got an entirely new set of error messages to contribute (see below). I'm not sure what the actual error is and what the @gprel relocation message is about. Any help greatly appreciated. I don't know for sure, but on many 64-bit OSes you cannot link code from static libraries into dynamic shared libraries, and that seems to be the case with ia64 Linux. Almost certainly you need to re-compile LAM with -fPIC flags. Yes, thanks a million, this solved the problem. While Rmpi now works, there is another issue connected with this one: I'm trying to use the papply package. However, when I do: library(papply) papply(list(1:10, 1:15, 1:20), sum) 1 slaves are spawned successfully. 0 failed. master (rank 0, comm 1) of size 2 is running on: behemoth slave1 (rank 1, comm 1) of size 2 is running on: behemoth [1] Running serial version of papply\n Papply only spawns one slave and then decides to run the serial version instead. I'm not sure how to tell it to use all the 64 processors available. Hendrik -- Hendrik Fuß PhD student Systems Biology Research Group University of Ulster, School of Biomedical Sciences Cromore Road, Coleraine, BT52 1SA, Northern Ireland __ 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] regular expressions with grep() and negative indexing

Stephen Tucker wrote: Dear R-helpers, Does anyone know how to use regular expressions to return vector elements that don't contain a word? For instance, if I have a vector x - c(seal.0,seal.1-exclude) I'd like to get back the elements which do not contain the word exclude, using something like (I know this doesn't work) but: grep([^(exclude)],x) I can use x[-grep(exclude,x)] for this case but then if I use this expression in a recursive function, it will not work for instances in which the vector contains no elements with that word. For instance, if I have x2 - c(dolphin.0,dolphin.1) then x2[-grep(exclude,x2)] will give me 'character(0)' I know I can accomplish this in several steps, for instance: myfunc - function(x) { iexclude - grep(exclude,x) if(length(iexclude) 0) x2 - x[-iexclude] else x2 - x # do stuff with x2 ...? } But this is embedded in a much larger function and I am trying to minimize intermediate variable assignment (perhaps a futile effort). But if anyone knows of an easy solution, I'd appreciate a tip. It has come up a couple of times before, and yes, it is a bit of a pain. Probably the quickest way out is negIndex - function(i) if(length(i)) -i else TRUE -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-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] regarding 3d Bar Plot

On 4/24/2007 9:38 AM, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. snip Many years ago I picked up from the snews mailing list a suite of functions for plotting 2D barplots (barplots with 2D bases) written by a chap named Colin Goodall, from (at that time) the University of Bristol and/or from Penn State. I never actually did anything with this suite until recently. Seeing no replies to the enquiry about 3D histograms, I thought I'd try to get Goodal's code running in R to see if it might solve guarav's problem. The trouble is, all the guts of the procedure, *including* the plotting are done from within Fortran. The actual plotting seems to be done through a call to a subroutine ``segmtz'' which is a piece of Splus software that does not exist in R. Is there an equivalent subroutine in R that could be called? I dug around a bit but couldn't figure out what was going on. The function segments() simply calls .Internal(segments( I looked around a bit for corresponding C or Fortran code but obviously didn't know how to look properly. I think that the Fortran code could be translated into raw R and the call to segmtz changed to a call to segments() --- but this would seem to be a lot of work. Can anyone suggest a reasonably simple way of replacing the call to segmtz in the Fortran? I don't know how to do what you want, but I'd suggest working in R code rather than Fortran. I did write a hist3d function for the djmrgl package (based on hist), mostly to show off the graphics, but haven't found it useful enough to port to rgl. Here's a quick port, not good enough to use, but maybe it will give you a starting point. Duncan Murdoch hist3d - function (x, y, xbreaks, ybreaks, freq= NULL, probability = !freq, include.lowest= TRUE, right= TRUE, xlim = range(xbreaks), ylim = range(ybreaks), zlim = NULL, xlab = xname, ylab = yname, zlab, plot = TRUE, top = TRUE, nclass = NULL, ...) { if (!is.numeric(x) | !is.numeric(y)) stop(`x' and `y' must be numeric) xname - deparse(substitute(x)) yname - deparse(substitute(y)) n - length(x - x[!is.na(x)]) use.xbr - !missing(xbreaks) if(use.xbr) { if(!missing(nclass)) warning(`nclass' not used when `xbreaks' specified) } else if(!is.null(nclass) length(nclass) == 1) xbreaks - nclass use.xbr - use.xbr (nB - length(xbreaks)) 1 if(use.xbr) xbreaks - sort(xbreaks) else { # construct vector of breaks rx - range(x) nnb - if(missing(xbreaks)) 1 + log2(n) else { # breaks = `nclass' if (is.na(xbreaks) | xbreaks 2) stop(invalid number of xbreaks) xbreaks } xbreaks - pretty (rx, n = nnb, min.n=1, eps.corr = 2) } nxB - length(xbreaks) if(nxB = 1) ##-- Impossible ! stop(paste(hist3d: error, xbreaks=,format(xbreaks))) storage.mode(x) - double storage.mode(xbreaks) - double use.ybr - !missing(ybreaks) if(use.ybr) { if(!missing(nclass)) warning(`nclass' not used when `ybreaks' specified) } else if(!is.null(nclass) length(nclass) == 1) ybreaks - nclass use.ybr - use.ybr (nB - length(ybreaks)) 1 if(use.ybr) ybreaks - sort(ybreaks) else { # construct vector of breaks ry - range(y) nnb - if(missing(ybreaks)) 1 + log2(n) else { # breaks = `nclass' if (is.na(ybreaks) | ybreaks 2) stop(invalid number of ybreaks) ybreaks } ybreaks - pretty (ry, n = nnb, min.n=1, eps.corr = 2) } nyB - length(ybreaks) if(nyB = 1) ##-- Impossible ! stop(paste(hist3d: error, ybreaks=,format(ybreaks))) storage.mode(y) - double storage.mode(ybreaks) - double counts - table(cut(x,xbreaks),cut(y,ybreaks)) if (sum(counts) n) stop(some data not counted; maybe breaks do not span range of data) xh - diff(xbreaks) if

### Re: [R] regular expressions with grep() and negative indexing

Find the ones that match and then remove them from the full set with 'setdiff'. x - c(seal.0,seal.1-exclude) x.match - grep(exclude, x) # find matches x.match [1] 2 setdiff(seq_along(x), x.match) # exclude the matches [1] 1 On 4/25/07, Peter Dalgaard [EMAIL PROTECTED] wrote: Stephen Tucker wrote: Dear R-helpers, Does anyone know how to use regular expressions to return vector elements that don't contain a word? For instance, if I have a vector x - c(seal.0,seal.1-exclude) I'd like to get back the elements which do not contain the word exclude, using something like (I know this doesn't work) but: grep([^(exclude)],x) I can use x[-grep(exclude,x)] for this case but then if I use this expression in a recursive function, it will not work for instances in which the vector contains no elements with that word. For instance, if I have x2 - c(dolphin.0,dolphin.1) then x2[-grep(exclude,x2)] will give me 'character(0)' I know I can accomplish this in several steps, for instance: myfunc - function(x) { iexclude - grep(exclude,x) if(length(iexclude) 0) x2 - x[-iexclude] else x2 - x # do stuff with x2 ...? } But this is embedded in a much larger function and I am trying to minimize intermediate variable assignment (perhaps a futile effort). But if anyone knows of an easy solution, I'd appreciate a tip. It has come up a couple of times before, and yes, it is a bit of a pain. Probably the quickest way out is negIndex - function(i) if(length(i)) -i else TRUE -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ 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] regarding 3d Bar Plot

Hi Duncan I am restating the problem and thanks you for sending me such a good function histogram in 3d. Thanks for that but i think my problem has been misinterpreted. I just wanted a simple 3d bar Plot. Although I have not written anything for R but i will surely like to contribute to R and if i can assist someone in writing then it would be a great help to me. Problem was :-) I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. (Please note on my X and Y axes Numbers are not there instead alphabets) A B C D E F G H I P 0 0 20 60 0 0 20 0 0 Q 0 16.8674726.907631 11.646586 0 12.449799 0.8032129 0 31.325301 R 0 59.649123 10.526316 12.280702 0 0 1.7543860 15.789474 S 3.57909807 20.281556 33.404915 7.31329 0.584586 5.9651631.1930327 0 27.678358 T 0 0 0 0 0 0 0 0 0 U 0 9.09090927.272727 18.181818 0 36.363636 0 0 9.090909 V 0 33.33 33.33 0 0 33.33 0 0 0 W 0 2.1881841.09409236.105033 0 44.420131 5.2516411 0 10.940919 X 0.05994234 51.550409 16.304315 6.9976680 17.383277 0.5994234 0.4741439 6.630821 Thanks in advance -gaurav Duncan Murdoch [EMAIL PROTECTED] 25-04-07 04:42 PM To [EMAIL PROTECTED] cc [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject Re: [R] regarding 3d Bar Plot On 4/24/2007 9:38 AM, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. snip Many years ago I picked up from the snews mailing list a suite of functions for plotting 2D barplots (barplots with 2D bases) written by a chap named Colin Goodall, from (at that time) the University of Bristol and/or from Penn State. I never actually did anything with this suite until recently. Seeing no replies to the enquiry about 3D histograms, I thought I'd try to get Goodal's code running in R to see if it might solve guarav's problem. The trouble is, all the guts of the procedure, *including* the plotting are done from within Fortran. The actual plotting seems to be done through a call to a subroutine ``segmtz'' which is a piece of Splus software that does not exist in R. Is there an equivalent subroutine in R that could be called? I dug around a bit but couldn't figure out what was going on. The function segments() simply calls .Internal(segments( I looked around a bit for corresponding C or Fortran code but obviously didn't know how to look properly. I think that the Fortran code could be translated into raw R and the call to segmtz changed to a call to segments() --- but this would seem to be a lot of work. Can anyone suggest a reasonably simple way of replacing the call to segmtz in the Fortran? I don't know how to do what you want, but I'd suggest working in R code rather than Fortran. I did write a hist3d function for the djmrgl package (based on hist), mostly to show off the graphics, but haven't found it useful enough to port to rgl. Here's a quick port, not good enough to use, but maybe it will give you a starting point. Duncan Murdoch hist3d - function (x, y, xbreaks, ybreaks, freq= NULL, probability = !freq, include.lowest= TRUE, right= TRUE, xlim = range(xbreaks), ylim = range(ybreaks), zlim = NULL, xlab = xname, ylab = yname, zlab, plot = TRUE, top

### Re: [R] correlation table

Possible: yes - just calcuate correlation of as.numeric(your.factors) Meaningful: no It will depend on the coding for your factors, which may be absolutely arbitrally... Petr elyakhlifi mustapha napsal(a): hello, is it possible to create a correlation table between factors? ___ [[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. -- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic __ 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] regarding 3d Bar Plot --- correction.

Hi Rolf, If it is possible then please share the code as i am not able to locate any pointers. Thanks in advance :-) cheers and chiao regards -gaurav [EMAIL PROTECTED] 24-04-07 07:27 PM To [EMAIL PROTECTED], r-help@stat.math.ethz.ch cc Subject Re: [R] regarding 3d Bar Plot --- correction. I mis-spoke. It seems I had two collections of functions in the same directory. One by Colin Goodall, and one by David Scott (I have no record of where he is/was located). It is the *latter* collection that does all its work from within Fortran. I'll have another look at what Colin Goodall actually wrote to see if it could be useful to guarav. cheers, Rolf Turner [EMAIL PROTECTED] DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{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] Coercing data types for use in model.frame

You could try to follow the code in the dyn package. It intercepts model.frame calls involving time series objects so that it can align lagged objects: e.g. z - ts(seq(10)^2) library(dyn) dyn$lm(z ~ lag(z, -1)) It transforms the last line above to: dyn(lm(dyn(z ~ lag(z, -1))) and the inner dyn then produces a formula with class c(dyn, model.frame) so that model.frame.dyn can intercept the call while the outer dyn adds dyn to the class of the result so that anova.dyn, predict.dyn, etc. can be used to intercept the result. Thus for any lm-like function you just preface it with dyn$ as shown and you get automatically alignment of time series or in your case you would interception of the mChoice variables. On 4/24/07, Frank E Harrell Jr [EMAIL PROTECTED] wrote: In the Hmisc package there is a new data class 'mChoice' for multiple choice variables. There are format and as.numeric methods (the latter creates a matrix of dummy variables). mChoice variables are not allowed by model.frame. Is there a way to specify a conversion function that model.frame will use automatically? I would use as.factor here. model.frame does not seem to use as.data.frame.foo for individual variables. Thanks Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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] RE : for loops

I know that a looping solution was requested, but this is exactly what apply() should be used for... Petr justin bem napsal(a): You can see with this simple example. matrix.t.test-function(mx){ p-dim(mx)[2] #number of column in the matrix n-dim(mx)[1] #number of row n.tests- p*(p-1)/2 #Number of tests to be done tested.var -rep(,n.tests) #Keep rang of tested column r.t.stat-rep(0, n.tests)#contain t.stat r.p.val -rep(0, n.tests)#contain p.values ctst-1 #current test for (i in 1:(p-1)){ for (j in (i+1):p){ r.t.stat[ctst]-t.test(mx[,i],mx[,j])$statistic r.p.val [ctst] -t.test(mx[,i],mx[,j])$p.value tested.var [ctst]-paste(i,-,j) ctst-ctst+1 } } result-data.frame(tested.var,r.t.stat,r.p.val) return(result) } matrix.t.test(matrix(rnorm(50),nr=10,nc=5)) --- [EMAIL PROTECTED] [EMAIL PROTECTED] a écrit : Hello everybody I'm very new at using R so probably this is a very stupid question. I have a matrix of p columns and I have to calculate for each of them the two sample t-statistic and p-value and to save the results into two different vectors. I have divided my matrix into two submatrices: submatrix A containing the first n1 rows (p columns) and submatrix B containing the remaining n2 (total rows=n1+n2). How can I do this with for loop construction? Friendly regards Silvia -- Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom http://click.libero.it/infostrada __ 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. Justin BEM Elève Ingénieur Statisticien Economiste BP 294 Yaoundé. Tél (00237)9597295. __ 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. -- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic __ 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 very simple question

If by objects you mean the packages you installed and assuming you are on Windows then there are two batch files movedir.bat and copydir.bat in the batchfiles distribution that will either move them from an older version (they won't be available to the older version any more but its much faster and they won't be taking up space twice) or copy them (they will now be in both versions so you can use them from either but its slower and they will be taking up space twice). See the batchfiles home page: http://code.google.com/p/batchfiles/ which has a link to the download site and a link to the README which you should be sure to read. On 4/25/07, David Kaplan [EMAIL PROTECTED] wrote: Hi all, I just loaded R 2.50. I want this version to bring the objects from the previous version. How do I do that? Thanks David __ 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] Help with saptial analysis (cluster)

Dear Fransico, The distance matrix would be 102000 x 102000. So it would contain 1040400 values. If you need one bit for each value, this would requier 9,7 GB. So the distance matrix won't fit in the RAM of your computer. Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Francisco Pastor Verzonden: woensdag 25 april 2007 12:34 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] Help with saptial analysis (cluster) Hi R-users I'm a beginner with R and statistics, so I need some help to start my data analysis. I've been reading some docs and tutorials on R and cluster analysis. I've got a large dataset (102000 points) with values of longitude, latitude and temperature and want to see if I can find groups (clusters). Following some tutorials I can look for principal components but get an error with calculation of distances: matriz.distancias-dist(comp.obs) Error in vector(double, length) : specified vector size is too big (translated from spanish) So, my questions are: is the dataset too big? could you point me to any docs explaining how to study spatially distributed data (lon,lat,data)? Thanks in advance __ _ Francisco Pastor Meteorology department Fundación CEAM [EMAIL PROTECTED] http://www.gva.es/ceamet http://www.gva.es/ceam Paterna, Valencia, Spain __ _ Usuario Linux registrado: 363952 __ 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] prelim.norm() function not working

Thank you very much, that was indeed the problem. (And now that I read more carefully the help page, it did in fact say that the input was a data matrix and not a data frame.) Brant -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: Wednesday, April 25, 2007 12:12 AM To: Brant Inman Cc: r-help@stat.math.ethz.ch Subject: Re: [R] prelim.norm() function not working Looks like you have a data frame where you need a matrix. (The same issue occurs in most of Joe Schafer's packages, e.g. mix.) Try as.matrix(usnews). On Tue, 24 Apr 2007, Brant Inman wrote: R-experts: I am trying to reproduce some of Paul Allison's results in his little green book on missing data (Sage 2002). The dataset for which I am having problems, usnews, can be found at: http://www.ats.ucla.edu/stat/books/md/default.htm. I am working on a Windows machine with R 2.5 installed, all packages up-to-date. The problem has to do with the prelim.norm() function of the package norm. Specifically, I need to use this pre-processing function to later use the EM algorithm and DA procedures in the norm package. I am getting an error with the following code. -- pre - prelim.norm(usnews) Error in as.double.default(list(csat = c(972L, 961L, NA, 881L, NA, NA, : (list) object cannot be coerced to 'double' - I have read the previous postings and I am wondering if the problem with prelim.norm is the size of the usnews dataset or the amount of missing data. dim(usnews) [1] 13027 Does anyone have any ideas? If not, are there alternatives to norm for implementing the MLE and EM methods of dealing with missing data? Thanks, Brant Inman Mayo Clinic __ 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] program avail. for simulating spatial patterns?

Hi all, I am wondering if there is a function available in R for simulating spatial distribution of objects (plants in this case) in order to simulate sampling of a population . Specifically, I would like to be able to change the spatial correlation of individuals. I don't want to reinvent the wheel if it already exists. Thanks, Wade __ 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] assigning two conditions to grep()

Hi, i have a problem in assigning 2 conditions to grep() , my data look like this: DA 24 N7 Rad= 3.4 20 Sac= 0.93 Acc= 4.76 DA 24 N7 Rad= 3.4 14 Sac= 0.65 Acc= 3.33 DA 24 N7 Rad= 3.4 3 Sac= 0.14 Acc= 0.71 DA 24 N7 Rad= 3.4 11 Sac= 0.51 Acc= 2.62 DG 23 N7 Rad= 3.4 8 Sac= 0.37 Acc= 1.91 DG 23 N7 Rad= 3.4 5 Sac= 0.23 Acc= 1.19 DG 23 N7 Rad= 3.4 0 Sac= 0.00 Acc= 0.00 DG 23 N7 Rad= 3.4 3 Sac= 0.14 Acc= 0.71 DG 23 O6 Rad= 3.3 0 Sac= 0.00 Acc= 0.00 DG 23 O6 Rad= 3.3 1 Sac= 0.04 Acc= 0.22 DG 23 O6 Rad= 3.3 0 Sac= 0.00 Acc= 0.00 DG 23 O6 Rad= 3.3 0 Sac= 0.00 Acc= 0.00 (it's a data.frame) at first i wanted all the line begining with A 24: data[grep(^24, data$V2)] this works and than i wanted to exctract all the lines with G23 N7, neither the column 23 and the column N7 are unique so i tried this data[grep(^23*N7, data),] but doesn't work not either x[(grep(^N7, as.character(x$V3))) (grep(^23, x$V2)),] he just returns everything. thank u for any help, josephine __ 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] regarding 3d Bar Plot

On 4/25/2007 7:56 AM, [EMAIL PROTECTED] wrote: Hi Duncan I am restating the problem and thanks you for sending me such a good function histogram in 3d. Thanks for that but i think my problem has been misinterpreted. I just wanted a simple 3d bar Plot. Although I have not written anything for R but i will surely like to contribute to R and if i can assist someone in writing then it would be a great help to me. Problem was :-) I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. (Please note on my X and Y axes Numbers are not there instead alphabets) The plot.histogram function I sent does most of what you want. The hist3d function calculates the matrix of counts that it plots, and plot.histogram plots the resulting bar chart. Duncan Murdoch A B C D E F G H I P 0 0 20 60 0 0 20 0 0 Q 0 16.8674726.907631 11.646586 0 12.449799 0.8032129 0 31.325301 R 0 59.649123 10.526316 12.280702 0 0 1.7543860 15.789474 S 3.57909807 20.281556 33.404915 7.31329 0.584586 5.9651631.1930327 0 27.678358 T 0 0 0 0 0 0 0 0 0 U 0 9.09090927.272727 18.181818 0 36.363636 0 0 9.090909 V 0 33.33 33.33 0 0 33.33 0 0 0 W 0 2.1881841.09409236.105033 0 44.420131 5.2516411 0 10.940919 X 0.05994234 51.550409 16.304315 6.9976680 17.383277 0.5994234 0.4741439 6.630821 Thanks in advance -gaurav Duncan Murdoch [EMAIL PROTECTED] 25-04-07 04:42 PM To [EMAIL PROTECTED] cc [EMAIL PROTECTED], r-help@stat.math.ethz.ch Subject Re: [R] regarding 3d Bar Plot On 4/24/2007 9:38 AM, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. snip Many years ago I picked up from the snews mailing list a suite of functions for plotting 2D barplots (barplots with 2D bases) written by a chap named Colin Goodall, from (at that time) the University of Bristol and/or from Penn State. I never actually did anything with this suite until recently. Seeing no replies to the enquiry about 3D histograms, I thought I'd try to get Goodal's code running in R to see if it might solve guarav's problem. The trouble is, all the guts of the procedure, *including* the plotting are done from within Fortran. The actual plotting seems to be done through a call to a subroutine ``segmtz'' which is a piece of Splus software that does not exist in R. Is there an equivalent subroutine in R that could be called? I dug around a bit but couldn't figure out what was going on. The function segments() simply calls .Internal(segments( I looked around a bit for corresponding C or Fortran code but obviously didn't know how to look properly. I think that the Fortran code could be translated into raw R and the call to segmtz changed to a call to segments() --- but this would seem to be a lot of work. Can anyone suggest a reasonably simple way of replacing the call to segmtz in the Fortran? I don't know how to do what you want, but I'd suggest working in R code rather than Fortran. I did write a hist3d function for the djmrgl package (based on hist), mostly to show off the graphics, but haven't found it useful enough to port to rgl. Here's a quick port, not good enough to use, but maybe it will give you a

### Re: [R] program avail. for simulating spatial patterns?

Have a look at packages in the spatial taskview (spatstat, splancs). Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Wade Wall Verzonden: woensdag 25 april 2007 15:03 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] program avail. for simulating spatial patterns? Hi all, I am wondering if there is a function available in R for simulating spatial distribution of objects (plants in this case) in order to simulate sampling of a population . Specifically, I would like to be able to change the spatial correlation of individuals. I don't want to reinvent the wheel if it already exists. Thanks, Wade __ 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] regarding 3d Bar Plot

I am restating the problem and thanks you for sending me such a good function histogram in 3d. Thanks for that but i think my problem has been misinterpreted. I just wanted a simple 3d bar Plot. Although I have not written anything for R but i will surely like to contribute to R and if i can assist someone in writing then it would be a great help to me. Problem was :-) I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. (Please note on my X and Y axes Numbers are not there instead alphabets) I suggest that you don't use a 3d bar chart. 3d bar charts are generally hard to interpret for two reasons: large bars will obscure small bars behind them, and it is very difficult to judge the true length of the bars. I suggest you try creating a series of 2d bar charts instead - you are far more likely to be able to interpret them easily. For this data, you might also want to look into fluctuation diagrams. Hadley __ 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 CMD CHECK and require() / library() methods

Hi, I have a piece of code that decides at runtime whether to load a data package (and which package to load). This is then done with a call to: library(x) (where x is a character variable containing the package name). This causes R CMD check to throw out a warning: 'library' or 'required' calls not declared from: x Does anyone have any suggestions as to a fix or workaround for this? Crispin This email is confidential and intended solely for the use o...{{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] How to identify and exclude the outliers with R?

Hello, everyone, I want to ask a simple question. If I have a set of data,and I want to identify how many outliers there are in the data.Which packages and functions can I use? Thanks. Shao chunxuan. [[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] creating random numbers

l want to create a column of 1 and 2 randomly what command should l use eg treatment strata 1 1 2 0 1 1 2 1 2 0 2 1 2 0 1 0 these should be created randomly secondly if l have something like for (i in 1:n ) df =c(1,rexp(1,.001),rexp(1,.002)) can l add an if statement in side the c maybe to compare the 2 exponential numbers to create another variable - [[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] regarding 3d Bar Plot

On 4/25/2007 9:26 AM, hadley wickham wrote: I am restating the problem and thanks you for sending me such a good function histogram in 3d. Thanks for that but i think my problem has been misinterpreted. I just wanted a simple 3d bar Plot. Although I have not written anything for R but i will surely like to contribute to R and if i can assist someone in writing then it would be a great help to me. Problem was :-) I have data in a two dimensional table. each row of the data adds upto 100 ( hence they are percentages ). it can be interpreted as like this A - I are the matches and P - X are the players. Thus Player P scored 20% of the runs during this season in Match C, 60% in Match D and remaining 20% in Match G. I want to plot 3-d bar plot, where X axis have players, Y axis have Matches and Z axis as the percentage(0 - 100%) Please help me in this regards. (Please note on my X and Y axes Numbers are not there instead alphabets) I suggest that you don't use a 3d bar chart. 3d bar charts are generally hard to interpret for two reasons: large bars will obscure small bars behind them, and it is very difficult to judge the true length of the bars. I suggest you try creating a series of 2d bar charts instead - you are far more likely to be able to interpret them easily. I agree with this. Duncan Murdoch __ 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] NA and NaN randomForest

Hi Clayton, If you use the formula interface, then it should do what you want: R library(randomForest) randomForest 4.5-18 Type rfNews() to see new features/changes/bug fixes. R iris1 - iris[-(1:5),] R iris2 - iris[1:5,] R iris2[1, 3] - NA R iris2[3, 1] - NA R iris.rf - randomForest(Species ~ ., iris1) R predict(iris.rf, iris2[-5]) [1] NA setosa NA setosa setosa Levels: setosa versicolor virginica The problem, of course, is that the formula interface is not suitable for data with large number of variables. I'll look into doing the same thing in the default method. Andy From: [EMAIL PROTECTED] Dear R-help, This is about randomForest's handling of NA and NaNs in test set data. Currently, if the test set data contains an NA or NaN then predict.randomForest will skip that row in the output. I would like to change that behavior to outputting an NA. Can this be done with flags to randomForest? If not can some sort of wrapper be built to put the NAs back in? thanks, Clayton _ CONFIDENTIALITY NOTICE\ \ The information contained in this ...{{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. -- Notice: This e-mail message, together with any attachments,...{{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] creating random numbers

sample(1:2, 10, replace=TRUE) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of raymond chiruka Sent: Wednesday, April 25, 2007 9:45 AM To: r-help@stat.math.ethz.ch Subject: [R] creating random numbers l want to create a column of 1 and 2 randomly what command should l use eg treatment strata 1 1 2 0 1 1 2 1 2 0 2 1 2 0 1 0 these should be created randomly secondly if l have something like for (i in 1:n ) df =c(1,rexp(1,.001),rexp(1,.002)) can l add an if statement in side the c maybe to compare the 2 exponential numbers to create another variable - [[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.

### Re: [R] Random Number Generator of Park and Miller

On Tue, 24 Apr 2007, gracezhang wrote: Hi, I failed to search for R package providing random number generator of Park and Miller. Anyone know any R package supporting this kind of function? rng.lcg-function(x,p1=16807,p2=0,N=2147483647){(x*p1+p2)%%N} Dave -- Dr. David Forrest [EMAIL PROTECTED](804)684-7900w [EMAIL PROTECTED] (804)642-0662h http://maplepark.com/~drf5n/ __ 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] print format - fixed number of digits

Hi, is it possible to format real (double) numbers in a data frame to an exact format? I need something like format(..., digits=5) but this is a suggestion only and I need exactly 5 digits. Example where there are more than 5 digits printed follows. I can do it via cbind(as.numeric(sprintf(%.5f,column_1)), as.numeric(sprintf(%.5f,column_2)),...) but it is really annoying and there must be an easier solution. Petr x - as.data.frame(matrix(rnorm(6),nrow=3)/100) x V1 V2 1 0.002640759 -0.002335782 2 -0.003960130 0.010373135 3 -0.007079349 -0.005792717 format(x,digits=5,scientific=FALSE) V1 V2 1 0.0026408 -0.0023358 2 -0.0039601 0.0103731 3 -0.0070793 -0.0057927 -- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic __ 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] Split column of concatenated data

Hi I have a column of concatenated information stored in an RG object in the limma package and I need to split this information and then paste the first two pieces of data in each case back into two columns of the RG object. This is how I am currently doing this gene.info.split-strsplit(RG$genes$Name,,,fixed=TRUE) for (h in 1: length(gene.info.split)){ RG$genes$ID[h]-gene.info.split[h][[1]][1] RG$genes$Name[h]-gene.info.split[h][[1]][2] } However, this is very slow and presumably 'messy'. The problem is that there are an inconsistent number of comma separated entries in the original Name column so I cannot do gene.info.split-as.data.frame(strsplit(RG$genes$Name,,,fixed=TRUE)) because I get the error message Error in data.frame(c(OligoCy3, SP Control poplar 48pin, A24, no length information : arguments imply differing number of rows: 4, 6, 5, 1 I also can't figure out how to usefully put the [list] data into a matrix (my ignorance I am sure). Ideally I would be able to put each comma separated item into a column and then simply paste the first and second columns over the RG$genes$Name and RG$genes$ID columns respectively (and do away with the for loop). Some cases in the original RG$genes$Name has only one piece of information (ie no commas) so I would need a way to fill any blanks with an NA value If anyone can help me, it would be much appreciated Nat Street --- Nathaniel Street University of Southampton Plants and Environment Lab School of Biological Sciences Basset Crescent East Southampton SO16 7PX tel: +44 (0) 2380 594268 fax: +44 (0) 2380 594269 [EMAIL PROTECTED] http://www.populus.biol.soton.ac.uk/~nat http://del.icio.us/n.r.street __ 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] barchart producing incorrect number of barcharts when columns renamed

Hi everybody, I'm having problems with the barchart command in the lattice package. I'm creating barcharts from matrices with with anything from 20 to 71 columns. When I leave the column names alone, that is they are set in the read.table command (and inherited by subsequent commands) the correct number barcharts is created by the print(barchart(...)) command. However, when I reset the column names by means of a scan command, the number of barcharts drawn by the same command is incorrect: it is always too few. The scan commands produce lists the same length as the number of columns for which I want barcharts. In total I've got four pages with barcharts. The numbers in the table below indicate the number of barcharts per page. The numbers without () are the number of barcharts that I expect (and get when I don't reset the column titles). The numbers in () are the numbers of barcharts I get when I reset the column titles. Not ClippedClipped Errs 20 (18) 71 (46) Stops 32 (24) 46 (36) The following is the code used to create the barcharts with sample text output below it. library('lattice') rm(list=ls()) textFontSize=6; pdf('../data/cocaineBarcharts.pdf', paper='a4') fontsize=trellis.par.get(fontsize); fontsize$text=textFontSize; trellis.par.set(fontsize, fontsize); resultsDirs=c(../data/Group.results.noclipping, ../data/ Group.results.clipped); #resultsDirs=c(../data/Group.results.clipped); for (resultsDir in resultsDirs) { cat(resultsDir, \n) if (any(grep(clipped, resultsDir))) { clipping=(Clipped); } else { clipping=(NOT Clipped); } roi.errs=read.table(paste(resultsDir, allGroupsROI.acrossGroupWithinEvent.errs, sep=/), header=T, sep=); roi.errs.names=names(roi.errs); # ctrl roi.errs.ctrl-roi.errs[roi.errs[,Group]==ctrl, 4:length (roi.errs)] roi.errs.ctrl.subjects=roi.errs[roi.errs[,Group]==ctrl, 2] # short roi.errs.short-roi.errs[roi.errs[,Group]==short, 4:length (roi.errs)] roi.errs.short.subjects=roi.errs[roi.errs[,Group]==short, 2] # long roi.errs.long-roi.errs[roi.errs[,Group]==long, 4:length (roi.errs)] roi.errs.long.subjects=roi.errs[roi.errs[,Group]==long, 2] roi.stops=read.table(paste(resultsDir, allGroupsROI.acrossGroupWithinEvent.stops, sep=/), header=T, sep=); roi.stops.names=names(roi.stops); # ctrl roi.stops.ctrl-roi.stops[roi.stops[,Group]==ctrl, 4:length (roi.stops)] roi.stops.ctrl.subjects=roi.stops[roi.stops[,Group]==ctrl, 2] # short roi.stops.short-roi.stops[roi.stops[,Group]==short, 4:length (roi.stops)] roi.stops.short.subjects=roi.stops[roi.stops[,Group]==short, 2] # long roi.stops.long-roi.stops[roi.stops[,Group]==long, 4:length (roi.stops)] roi.stops.long.subjects=roi.stops[roi.stops[,Group]==long, 2] #matrixToPlot=as.matrix(roi.errs.ctrl[1:5,]) #yylim=c(floor(min(matrixToPlot)), ceiling(max(matrixToPlot))) #barplot(matrixToPlot, col=c(2:6), beside=T, ylim=yylim, names.arg=colnames(roi.errs.ctrl), #border=c(2:6), legend.text=roi.errs$Subject[1:5]) roi.errs.ctrl.matrix=as.matrix(roi.errs.ctrl) roi.errs.short.matrix=as.matrix(roi.errs.short) roi.errs.long.matrix=as.matrix(roi.errs.long) roi.stops.ctrl.matrix=as.matrix(roi.stops.ctrl) roi.stops.short.matrix=as.matrix(roi.stops.short) roi.stops.long.matrix=as.matrix(roi.stops.long) # ### errors # # pdf(paste(resultsDir, 'errorsByGroup.pdf', sep=/), paper='a4') # fontsize=trellis.par.get(fontsize); # fontsize$text=textFontSize; # trellis.par.set(fontsize, fontsize); roi.errs.ctrl.means=colMeans(roi.errs.ctrl.matrix) roi.errs.short.means=colMeans(roi.errs.short.matrix) roi.errs.long.means=colMeans(roi.errs.long.matrix) yylim=c(floor(min(roi.errs[, 4:length(roi.errs)])), ceiling(max (roi.errs[, 4:length(roi.errs)]))) errs.Means=rbind(roi.errs.ctrl.means, roi.errs.short.means, roi.errs.long.means) rownames(errs.Means)=c('control', 'short', 'long') cat(errs.Means dimensions before col name change , dim (errs.Means), \n); colnames(errs.Means) = scan(paste(resultsDir, clusterLocations.errs.csv, sep=/), sep=,, what=character) cat(errs.Means dimensions after col name change , dim (errs.Means), \n); print(barchart(errs.Means, groups=rownames(errs.Means), xlab='Mean Intensity', main=paste(Mean Cluster Intensity for Errors, clipping), ylab='Group', col=rainbow(3), border=rainbow(3))) # dev.off()

### Re: [R] simulate values

Hello, Yes I tried arima.sim and everything works fine. Thanks for the help! Alin Soare 2007/4/25, Leeds, Mark (IED) [EMAIL PROTECTED]: he's just being a wise guy bcause I'm sure you meant to have an epsilon_t on the end. And he Surely knows that also. Did you Check out ?arima.sim. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges Sent: Wednesday, April 25, 2007 3:15 AM To: Soare Marcian-Alin Cc: R-help@stat.math.ethz.ch Subject: Re: [R] simulate values Soare Marcian-Alin wrote: Hello, I want to simulate 100 values of the ARMA Process with this function: x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] + 0.3 * x[i-3] There is no kind of noise in your model, hence no need to do any simulation so far ... Uwe Ligges which possibilities do I have? Alin Soare [[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. This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received via e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). [[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] levelplot and unequal cell sizes

I am using levelplot() from lattice with grids that have unequal cell sizes. This means that the boundary between two cells is not always half-way between nodes, as levelplot() assumes. The result is that some cell sizes are rendered incorrectly, which can be painfully obvious if using relatively large cells. Is there any work-around? I am using the conditioning capability of lattice and therefore image() would not be a good way to go. Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler _at_ pnl.gov __ 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] assigning two conditions to grep()

janek0 wrote: Dnia 25-04-2007, śro o godzinie 15:04 +0200, Abi Ghanem josephine napisał(a): use data[grep(^24|N7, data$V2)] and see ?regexp thanks for replying but actually my problem is that the column containing 23 is in data$V2 and the one containing N7 is in data$V3, so the line doen't work i just have all the line containing G23 N7 and G23 O6 and i want to separate the two. josephine __ 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 CMD CHECK and require() / library() methods

On Wed, 25 Apr 2007, Crispin Miller wrote: Hi, I have a piece of code that decides at runtime whether to load a data package (and which package to load). This is then done with a call to: library(x) (where x is a character variable containing the package name). This causes R CMD check to throw out a warning: 'library' or 'required' calls not declared from: x Which version of R is this? All I can find say 'require'. Does anyone have any suggestions as to a fix or workaround for this? That call should be library(x, character.only=TRUE) and that will in R 2.5.0 stop the warning AFAIK. -- 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 solve difficult equations?

At 03:15 AM 4/25/2007, francogrex wrote: This below is not solvable with uniroot to find a: fn=function(a){ b=(0.7/a)-a (1/(a+b+1))-0.0025 } uniroot(fn,c(-500,500)) gives Error in uniroot(fn, c(-500, 500)) : f() values at end points not of opposite sign I read R-help posts and someone wrote a function: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/92407.html but it is not very precise. Is there any 'standard function in R that can solve this? thanks. Actually, if you're solving fn(a)==0, then some trivial algebra leads to a linear equation with a=0.001754. Why are you trying to solve this numerically? Is it a single instance of a larger, more general problem? Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: [EMAIL PROTECTED] Least Cost Formulations, Ltd.URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239Fax: 757-467-2947 Vere scire est per causas scire __ 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] creating random numbers

?sample sample(c(1,2),10,replace=TRUE) P. raymond chiruka napsal(a): l want to create a column of 1 and 2 randomly what command should l use eg treatment strata 1 1 2 0 1 1 2 1 2 0 2 1 2 0 1 0 these should be created randomly secondly if l have something like for (i in 1:n ) df =c(1,rexp(1,.001),rexp(1,.002)) can l add an if statement in side the c maybe to compare the 2 exponential numbers to create another variable - [[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. -- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic __ 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 CMD CHECK and require() / library() methods

Many thanks! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Prof Brian Ripley Sent: 25 April 2007 16:03 To: Crispin Miller Cc: R-help@stat.math.ethz.ch Subject: Re: [R] R CMD CHECK and require() / library() methods On Wed, 25 Apr 2007, Crispin Miller wrote: Hi, I have a piece of code that decides at runtime whether to load a data package (and which package to load). This is then done with a call to: library(x) (where x is a character variable containing the package name). This causes R CMD check to throw out a warning: 'library' or 'required' calls not declared from: x Which version of R is this? All I can find say 'require'. My mistake - it was a typo it says: 'require' Does anyone have any suggestions as to a fix or workaround for this? That call should be library(x, character.only=TRUE) and that will in R 2.5.0 stop the warning AFAIK. It works - much appreciated... Crispin This email is confidential and intended solely for the use o...{{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] regular expressions with grep() and negative indexing

Peter Dalgaard wrote: Stephen Tucker wrote: Dear R-helpers, Does anyone know how to use regular expressions to return vector elements that don't contain a word? For instance, if I have a vector x - c(seal.0,seal.1-exclude) I'd like to get back the elements which do not contain the word exclude, using something like (I know this doesn't work) but: grep([^(exclude)],x) I can use x[-grep(exclude,x)] for this case but then if I use this expression in a recursive function, it will not work for instances in which the vector contains no elements with that word. For instance, if I have x2 - c(dolphin.0,dolphin.1) then x2[-grep(exclude,x2)] will give me 'character(0)' I know I can accomplish this in several steps, for instance: myfunc - function(x) { iexclude - grep(exclude,x) if(length(iexclude) 0) x2 - x[-iexclude] else x2 - x # do stuff with x2 ...? } But this is embedded in a much larger function and I am trying to minimize intermediate variable assignment (perhaps a futile effort). But if anyone knows of an easy solution, I'd appreciate a tip. It has come up a couple of times before, and yes, it is a bit of a pain. Probably the quickest way out is negIndex - function(i) if(length(i)) -i else TRUE ... which of course needs braces if typed on the command line negIndex - function(i) { if(length(i)) -i else TRUE } And I should probably also have said that it works like this: x2 - c(dolphin.0,dolphin.1) x2[-grep(exclude,x2)] character(0) x2[negIndex(grep(exclude,x2))] [1] dolphin.0 dolphin.1 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-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] assigning two conditions to grep()

On 25/04/07, Abi Ghanem josephine [EMAIL PROTECTED] wrote: Hi, i have a problem in assigning 2 conditions to grep() , my data look like this: DA 24 N7 Rad= 3.4 20 Sac= 0.93 Acc= 4.76 DA 24 N7 Rad= 3.4 14 Sac= 0.65 Acc= 3.33 DA 24 N7 Rad= 3.4 3 Sac= 0.14 Acc= 0.71 DA 24 N7 Rad= 3.4 11 Sac= 0.51 Acc= 2.62 DG 23 N7 Rad= 3.4 8 Sac= 0.37 Acc= 1.91 DG 23 N7 Rad= 3.4 5 Sac= 0.23 Acc= 1.19 DG 23 N7 Rad= 3.4 0 Sac= 0.00 Acc= 0.00 DG 23 N7 Rad= 3.4 3 Sac= 0.14 Acc= 0.71 DG 23 O6 Rad= 3.3 0 Sac= 0.00 Acc= 0.00 DG 23 O6 Rad= 3.3 1 Sac= 0.04 Acc= 0.22 DG 23 O6 Rad= 3.3 0 Sac= 0.00 Acc= 0.00 DG 23 O6 Rad= 3.3 0 Sac= 0.00 Acc= 0.00 (it's a data.frame) at first i wanted all the line begining with A 24: data[grep(^24, data$V2)] this works and than i wanted to exctract all the lines with G23 N7, neither the column 23 and the column N7 are unique so i tried this data[grep(^23*N7, data),] but doesn't work how about data[ intersect( grep(^24, data$V2), grep(N7,data$V3) ) , ] ? C. [[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] Getting Confused

Hello, I'm getting confused with my experience of R installing. I had R installed on January without any trouble. (I just had to install gcc4.1.1) Now I'd like to install a packages which requires tcl/tk. So basically I need to reconfigure and re install R right after having installed tcl/tk. So I installed tcl/tk I run the process to install R but I receive this error : checking for dummy main to link with Fortran libraries... none checking for Fortran name-mangling scheme... configure: error: cannot compile a simple Fortran program See `config.log' for more details. I checked in the config.log and the fact is that there's no fortran compiler installed. But don't gcc already have a fortran compiler in it? If somebody could help I would be thankful and especially if somebody has a clue why it worked without any error before and now yes. Thanks a lot Julien Steiner [[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] Box Ljung Statistics

Hi All R Experts, I met with below mentioned statistics in paper Stock Index Volatility Forecasting with High Frequency Data by Eugenie Hol, Siem Jan Koopman http://ideas.repec.org/p/dgr/uvatin/20020068.html I would like to ask that what is Box-Ljung portmantacau statistic based on N squared autocorrelation ? Is it same as Box-Ljung Statistics of stats package ? Further, please tell me how to compute it ? I have a return series of an Index. Please help me in this i am not able to get the statistics what is given in the paper for S P 100:-) Sayonara With Smile With Warm Regards :-) G a u r a v Y a d a v Assistant Manager, Economic Research Surveillance Department, Clearing Corporation Of India Limited. Address: 5th, 6th, 7th Floor, Trade Wing 'C', Kamala City, S.B. Marg, Mumbai - 400 013 Telephone(Office): - +91 022 6663 9398 , Mobile(Personal) (0)9821286118 Email(Office) :- [EMAIL PROTECTED] , Email(Personal) :- [EMAIL PROTECTED] DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{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] Unsubscription Confirmation

Thank you for subscribing. You have now unsubscribed and no more messages will be sent. __ 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] NA and NaN randomForest

Hi Andy, It worked for classification, but not regression. For example: iris1 - iris[-(1:5),] iris2 - iris[(1:5),] iris2[1,3] - NA iris2[3,1] - NA iris_sum - sum (iris$Sepal.Length + iris$Sepa.Width + iris$Petal.Length + iris$Petal.Width) iris_sum1 - iris_sum[-(1:5)] iris_sum2 - iris_sum[(1:5)] iris_sum.rf - randomForest (iris_sum1 ~ ., iris1[,c(1:4)]) predict (iris_sum.rf, iris2[-5]) predict (iris_sum.rf, iris2[-5]) [1] 9.556591 9.589573 10.104155 # Just to be clear I was hoping for behavior like the linear model has: iris_sum.lm - lm (iris_sum1 ~ ., iris1[,c(1:4)]) predict (iris_sum.lm, iris2[-5]) 12345 NA 9.5 NA 9.4 10.2 In the event that this is not available in the regression part of randomForest, is a work around possible? thanks, Clayton Liaw, Andy [EMAIL PROTECTED] 04/25/2007 09:59 AM To [EMAIL PROTECTED], r-help@stat.math.ethz.ch cc Subject RE: [R] NA and NaN randomForest Hi Clayton, If you use the formula interface, then it should do what you want: R library(randomForest) randomForest 4.5-18 Type rfNews() to see new features/changes/bug fixes. R iris1 - iris[-(1:5),] R iris2 - iris[1:5,] R iris2[1, 3] - NA R iris2[3, 1] - NA R iris.rf - randomForest(Species ~ ., iris1) R predict(iris.rf, iris2[-5]) [1] NA setosa NA setosa setosa Levels: setosa versicolor virginica The problem, of course, is that the formula interface is not suitable for data with large number of variables. I'll look into doing the same thing in the default method. Andy From: [EMAIL PROTECTED] Dear R-help, This is about randomForest's handling of NA and NaNs in test set data. Currently, if the test set data contains an NA or NaN then predict.randomForest will skip that row in the output. I would like to change that behavior to outputting an NA. Can this be done with flags to randomForest? If not can some sort of wrapper be built to put the NAs back in? thanks, Clayton _ CONFIDENTIALITY NOTICE\ \ The information contained in this ...{{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. -- Notice: This e-mail message, together with any attachments,...{{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] regular expressions with grep() and negative indexing

I use regexpr() instead of grep() in cases like this, e.g.: x2[regexpr(exclude,x2)==-1] (regexpr returns a vector of the same length as character vector given it, so there's no problem with it returning a zero length vector) -- Tony Plate Peter Dalgaard wrote: Stephen Tucker wrote: Dear R-helpers, Does anyone know how to use regular expressions to return vector elements that don't contain a word? For instance, if I have a vector x - c(seal.0,seal.1-exclude) I'd like to get back the elements which do not contain the word exclude, using something like (I know this doesn't work) but: grep([^(exclude)],x) I can use x[-grep(exclude,x)] for this case but then if I use this expression in a recursive function, it will not work for instances in which the vector contains no elements with that word. For instance, if I have x2 - c(dolphin.0,dolphin.1) then x2[-grep(exclude,x2)] will give me 'character(0)' I know I can accomplish this in several steps, for instance: myfunc - function(x) { iexclude - grep(exclude,x) if(length(iexclude) 0) x2 - x[-iexclude] else x2 - x # do stuff with x2 ...? } But this is embedded in a much larger function and I am trying to minimize intermediate variable assignment (perhaps a futile effort). But if anyone knows of an easy solution, I'd appreciate a tip. It has come up a couple of times before, and yes, it is a bit of a pain. Probably the quickest way out is negIndex - function(i) if(length(i)) -i else TRUE __ 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 News, volume 7, issue 1 is now available

Hi The October 2006 issue of R News is now available on CRAN under the Documentation/Newsletter link. Torsten (on behalf of the R News Editorial Board) ___ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ 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 identify and exclude the outliers with R?

It depends on the nature of your data set. There is a package simply called 'outliers', which has the Grubbs/Dixon/Cochran tests. There is also the Bonferroni outlier test in 'car' package. I'm sure there are more in the hundreds of packages on CRAN. HTH Horace Shao [EMAIL PROTECTED] 4/25/2007 6:27:37 AM Hello, everyone, I want to ask a simple question. If I have a set of data,and I want to identify how many outliers there are in the data.Which packages and functions can I use? Thanks. Shao chunxuan. [[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.

### Re: [R] Getting Confused [Broadcast]

If you are serious in getting useful help, please do try to follow suggestions in the Posting Guide. You have not told us anything about your OS, the versions of R you tried to install, and exactly what you typed to build/install them. Many Linux distro by default do not install the Fortran part of GCC, so don't be surprised if that's the case for you (if you are trying to do this on some version of Linux). Andy From: Steiner, Julien Hello, I'm getting confused with my experience of R installing. I had R installed on January without any trouble. (I just had to install gcc4.1.1) Now I'd like to install a packages which requires tcl/tk. So basically I need to reconfigure and re install R right after having installed tcl/tk. So I installed tcl/tk I run the process to install R but I receive this error : checking for dummy main to link with Fortran libraries... none checking for Fortran name-mangling scheme... configure: error: cannot compile a simple Fortran program See `config.log' for more details. I checked in the config.log and the fact is that there's no fortran compiler installed. But don't gcc already have a fortran compiler in it? If somebody could help I would be thankful and especially if somebody has a clue why it worked without any error before and now yes. Thanks a lot Julien Steiner [[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. -- Notice: This e-mail message, together with any attachments,...{{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] R News, volume 7, issue 1 is now available

Torsten Hothorn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The October 2006 issue of R News is now available on CRAN under the Documentation/Newsletter link. Direct links are useful: R News http://cran.r-project.org/doc/Rnews/ April 2007 Issue: http://cran.r-project.org/doc/Rnews/Rnews_2007-1.pdf efg __ 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] Problem installing Rmpi with lam on SGI SLES9

Hendrik, Are you starting the lam daemons before starting R? % lamboot You might need to specify a 'hosts' argument to lamboot. The default way Rmpi calls lamboot is with no arguments, and this might simply create a single lam daemon. I don't usually use papply, but glancing at it's code suggests that it does require(Rmpi) and then decides based on the result of mpi.comm.size what to do. So to debug, load Rmpi and try mpi.comm.size. As a work-around, I think it should be possible to library(Rmpi) mpi.spawn.Rslaves(nslaves=64) # maybe a little bold, initially! before making your first papply call. Hope that helps Martin Hendrik Fuß [EMAIL PROTECTED] writes: On 24/04/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Tue, 24 Apr 2007, Hendrik Fuß wrote: Hi, I've been trying here to install Rmpi on an SGI IA-64 machine with 64 processors, running SuSE Linux Enterprise Server 9, R 2.4.0 and lam-mpi 7.1.3. While I've read of similar problems on this list, I think I've got an entirely new set of error messages to contribute (see below). I'm not sure what the actual error is and what the @gprel relocation message is about. Any help greatly appreciated. I don't know for sure, but on many 64-bit OSes you cannot link code from static libraries into dynamic shared libraries, and that seems to be the case with ia64 Linux. Almost certainly you need to re-compile LAM with -fPIC flags. Yes, thanks a million, this solved the problem. While Rmpi now works, there is another issue connected with this one: I'm trying to use the papply package. However, when I do: library(papply) papply(list(1:10, 1:15, 1:20), sum) 1 slaves are spawned successfully. 0 failed. master (rank 0, comm 1) of size 2 is running on: behemoth slave1 (rank 1, comm 1) of size 2 is running on: behemoth [1] Running serial version of papply\n Papply only spawns one slave and then decides to run the serial version instead. I'm not sure how to tell it to use all the 64 processors available. Hendrik -- Hendrik Fuß PhD student Systems Biology Research Group University of Ulster, School of Biomedical Sciences Cromore Road, Coleraine, BT52 1SA, Northern Ireland __ 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] levelplot and unequal cell sizes

On 4/25/07, Waichler, Scott R [EMAIL PROTECTED] wrote: I am using levelplot() from lattice with grids that have unequal cell sizes. This means that the boundary between two cells is not always half-way between nodes, as levelplot() assumes. The result is that some cell sizes are rendered incorrectly, which can be painfully obvious if using relatively large cells. Is there any work-around? I am using the conditioning capability of lattice and therefore image() would not be a good way to go. You might be able to use the tile plot in ggplot, which allows you to specify the size of each tile (it assumes they're all the same size by default). Have a look at ?ggtile, or if you provide more info about your data, I could provide a worked example. Regards, Hadley __ 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 News, volume 7, issue 1 is now available

Earl F. Glynn wrote: Torsten Hothorn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The October 2006 issue of R News is now available on CRAN under the Documentation/Newsletter link. Direct links are useful: R News http://cran.r-project.org/doc/Rnews/ April 2007 Issue: http://cran.r-project.org/doc/Rnews/Rnews_2007-1.pdf efg ... And maybe the TOC: Editorial Viewing Binary Files with the hexView Package FlexMix: An R Package for Finite Mixture Modelling Using R to Perform the AMMI Analysis on Agriculture Variety Trials Inferences for Ratios of Normal Means Working with Unknown Values A New Package for Fitting Random Effect Models Augmenting R with Unix Tools POT: Modelling Peaks Over a Threshold Backtests Review of John Verzani’s Book Using R for Introductory Statistics DSC 2007 New Journal: Annals of Applied Statistics Forthcoming Events: useR! 2007 Changes in R 2.5.0 Changes on CRAN R Foundation News R News Referees 2006 -- Mango Solutions data analysis that delivers Tel: +44(0) 1249 467 467 Fax: +44(0) 1249 467 468 Mob: +44(0) 7813 526 123 __ 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] Coercing data types for use in model.frame

Prof Brian Ripley wrote: Moved to R-devel What is the 'data class'? In particular what is its underlying type? And where in model.frame[.default] are you trying to use it (in the formula, data, in ..., etc). This is an example of where some reproducible code and the error messages would be very helpful indeed. Brian Brian, Sorry - this was one of those too late in the day errors. The problem was in a function called just before model.frame. model.frame seems to work fine with an object of class c('mChoice', 'labelled'). It keeps mChoice variables as mChoice. After model.frame is finished I'll change such variables to factors or matrices. Frank On Tue, 24 Apr 2007, Frank E Harrell Jr wrote: In the Hmisc package there is a new data class 'mChoice' for multiple choice variables. There are format and as.numeric methods (the latter creates a matrix of dummy variables). mChoice variables are not allowed by model.frame. Is there a way to specify a conversion function that model.frame will use automatically? I would use as.factor here. model.frame does not seem to use as.data.frame.foo for individual variables. Thanks Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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] Box Ljung Statistics

Gaurav, I met with below mentioned statistics in paper Stock Index Volatility Forecasting with High Frequency Data by Eugenie Hol, Siem Jan Koopman http://ideas.repec.org/p/dgr/uvatin/20020068.html I would like to ask that what is Box-Ljung portmantacau statistic based on N squared autocorrelation ? Is it same as Box-Ljung Statistics of stats package ? Yes, it seems the same. But note that the paper computes the statistic for the raw data and also for the squared data. Further, please tell me how to compute it ? If you mean R, use the Box.test() function. If you mean theory, see any good book on time series like Brockwell and Davis' Introduction to Time Series and Forecasting. I have a return series of an Index. Please help me in this i am not able to get the statistics what is given in the paper for S P 100:-) I can't help you here since I don't have the 5-minute data used in the paper. Rogerio __ 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] Scripting graph generation

Hi, I'm looking to automate the generation of some graphs in R. I can't seem to figure out how to script R, and change the output device of hist() or plot() to create a .gif or .png file. This seems like something that is probably really simple, and I've just overlooked the call do do it. Can anyone point me in the right direction, or maybe send a sample script? thanks, --Mike Huber [[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] GLS terminology question not related to R

This is a terminology question not related to R. The literature often says that OLS is inefficient relative to GLS if the residuals in the system are correlated ( and the RHS sides of each are not identical ). Does this mean that OLS overestimates residual and coefficient variances , underestimates them or just gets them wrong and the direction is not known ? Thanks. 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] [R-pkgs] new package adegenet

The new package *adegenet* (linked to the ade4 package for multivariate analysis) has been released on CRAN. Its main focus is on molecular marker data handling for multivariate analysis. Adegenet offers data import/export functions (from GENETIX, Genepop, Fstat and to the packages genetics and hierfstat) as well as several data handling tools. It aims at facilitating the access to multivariate methods as well as to usual population genetics methods (HWE tests, G-statistic tests, ...). Suggestions, questions and contributions are welcome ! More information is available on the adegenet website: http://pbil.univ-lyon1.fr/software/adegenet/. http://pbil.univ-lyon1.fr/software/adegenet/ Regards, Thibaut Jombart. -- ## Thibaut JOMBART CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive Universite Lyon 1 43 bd du 11 novembre 1918 69622 Villeurbanne Cedex Tél. : 04.72.43.29.35 Fax : 04.72.43.13.88 [EMAIL PROTECTED] http://biomserv.univ-lyon1.fr/sitelabo/pageperso.php?id_personne=178 [[alternative HTML version deleted]] ___ 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] GLS terminology question not related to R

On Wed, 25 Apr 2007, Leeds, Mark (IED) wrote: This is a terminology question not related to R. The literature often says that OLS is inefficient relative to GLS if the residuals in the system are correlated ( and the RHS sides of each are not identical ). Does this mean that OLS overestimates residual and coefficient variances , underestimates them or just gets them wrong and the direction is not known ? Thanks. It does not mean either. It means that the true variance of the OLS estimates is greater than the true variance of the GLS estimates. A separate issue is whether the estimated variance of an OLS estimator is greater or less than the true variance of the OLS estimator. This can go either way. -thomas __ 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] levelplot and unequal cell sizes

On 4/25/07, Waichler, Scott R [EMAIL PROTECTED] wrote: I am using levelplot() from lattice with grids that have unequal cell sizes. This means that the boundary between two cells is not always half-way between nodes, as levelplot() assumes. levelplot() is not supposed to make any such assumptions. Can you provide a reproducible example please? -Deepayan The result is that some cell sizes are rendered incorrectly, which can be painfully obvious if using relatively large cells. Is there any work-around? I am using the conditioning capability of lattice and therefore image() would not be a good way to go. Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler _at_ pnl.gov __ 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

Hi all, I have 2 questions: 1)How do I calculate the mean on an imported txt file? I've imported the file below and that's what it looks like imported. How do I then calcuate the mean, median, or mode on the column LeafArea using the desktop R package? Any help would be greatly appreciated!! Thanks, Nat LeafType Leaflets LeafArea ShapeRatio LeafWeight LeafThickness 1 13 0.12 0.12 0.21 0.00 2 13 0.17 0.17 0.36 0.00 3 13 0.21 0.05 0.47 0.16 4 13 0.11 0.14 0.23 0.21 5 23 0.03 0.27 0.16 0.60 6 23 0.08 0.20 0.15 0.75 7 23 0.22 0.05 0.24 1.09 8 23 0.20 0.10 0.26 1.30 9 23 0.18 0.10 0.33 1.33 1023 0.14 0.07 0.19 1.36 1123 0.16 0.13 0.22 1.38 1223 0.18 0.06 0.25 1.39 1323 0.05 0.00 0.07 1.40 1423 0.11 0.01 0.21 1.41 1523 0.22 0.04 0.31 1.41 1623 0.09 0.10 0.13 1.44 1723 0.09 0.10 0.13 1.44 1823 0.13 0.08 0.19 1.46 1923 0.15 0.13 0.22 1.47 2023 0.15 0.03 0.22 1.47 2123 0.21 0.01 0.31 1.48 2213 0.21 0.14 0.32 1.50 2323 0.10 0.00 0.15 1.50 2413 0.26 0.60 0.40 1.53 2523 0.12 0.18 0.20 1.54 2623 0.20 0.15 0.31 1.55 2713 0.19 0.16 0.31 1.60 2813 0.13 0.00 0.21 1.62 2913 0.13 0.01 0.21 1.62 3013 0.37 0.27 0.60 1.62 3123 0.11 0.09 0.18 1.64 3223 0.14 0.00 0.23 1.64 3323 0.15 0.08 0.21 1.64 3423 0.20 0.10 0.33 1.65 3523 0.15 0.01 -0.25 1.67 3623 0.17 0.06 0.29 1.67 3723 0.13 0.08 0.22 1.69 3813 0.16 0.31 0.27 1.70 3913 0.21 0.01 0.40 1.70 4013 0.14 0.07 0.29 1.71 4123 0.14 0.00 0.24 1.71 4223 0.21 0.14 0.35 1.71 4323 0.11 0.09 0.19 1.73 4423 0.15 0.01 0.26 1.73 4523 0.19 0.11 0.33 1.74 4610 0.28 0.27 0.50 1.79 4713 0.10 0.01 0.18 1.80 4823 0.05 0.00 0.09 1.80 4913 0.12 0.11 0.22 1.83 5013 0.20 0.05 0.37 1.85 5123 0.14 0.14 0.26 1.86 5213 0.15 0.07 0.28 1.87 5313 0.15 0.01 0.28 1.87 5423 0.12 0.08 0.23 1.92 5523 0.15 0.00 0.29 1.93 5613 0.17 0.00 0.34 2.00 5713 0.21 0.02 0.42 2.00 5823 0.13 0.08 0.26 2.00 5913 0.16 0.06 0.32 2.05 6013 0.14 0.14 0.29 2.07 6123 0.12 0.08 0.25 2.08 6213 0.17 0.06 0.36 2.12 6313 0.13 0.08 0.28 2.13 6413 0.20 0.10 0.43 2.15 6513 0.26 0.08 0.56 2.15 6613 0.20 0.10 0.44 2.20 6713 0.19 0.11 0.42 2.21 6813 0.08 0.00 0.18 2.25 6913 0.12 0.00 0.27 2.25 7013 0.12 0.08 0.27

### Re: [R] Scripting graph generation

On Wed, 2007-04-25 at 13:21 -0400, Mike Huber wrote: Hi, I'm looking to automate the generation of some graphs in R. I can't seem to figure out how to script R, and change the output device of hist() or plot() to create a .gif or .png file. This seems like something that is probably really simple, and I've just overlooked the call do do it. Can anyone point me in the right direction, or maybe send a sample script? To plot multiple PNG files m - matrix(runif(100*10), nrow=10) png(filename = 'plot%03d.png') for (i in 1:nrow(m)) { plot(m[i,]) } dev.off() To plot multiple graphs as individual pages of a PDF file m - matrix(runif(100*10), nrow=10) pdf(file = 'plot.pdf') for (i in 1:nrow(m)) { plot(m[i,]) } dev.off() HTH, --- Rajarshi Guha [EMAIL PROTECTED] GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE --- In matrimony, to hesitate is sometimes to be saved. -- Butler __ 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] Самый доступный и недорогой метод похудения

«ÇÎËÎÒÀß ÑÅÐÜÃÀ» - ÈÇÁÀÂËÅÍÈÅ ÎÒ ËÈØÍÈÕ ÊÈËÎÃÐÀÌÌÎÂ (4 ÊÃ Â ÌÅÑ.)! ÌÈËËÈÎÍÛ ËÞÄÅÉ ÈÇÁÀÂÈËÈÑÜ ÎÒ ËÈØÍÈÕ ÊÈËÎÃÐÀÌÌÎÂ ÁËÀÃÎÄÀÐß ÇÎËÎÒÎÉ_ÑÅÐÜÃÅ ÁÅÇ ÔÈÇÈ×ÅÑÊÈÕ ÓÏÐÀÆÍÅÍÈÉ, ÈÑÒßÇÀÞÙÈÕ ÄÈÅÒ, ÒÀÁËÅÒÎÊ!! ÑÒÎÈÌÎÑÒÜ «ÇÎËÎÒÎÉ ÑÅÐÜÃÈ» ÂÑÅÃÎ 3000 ÐÓÁ.!! Ïðèíöèï ìåòîäà Çîëîòàÿ Ñåðüãà ñîçäàí îñíîâûâàÿñü íà ñåêðåòàõ òðàäèöèîííîé Êèòàéñêîé ìåäèöèíû. «Çîëîòàÿ Ñåðüãà» âîçäåéñòâóåò íà áèîëîãè÷åñêè àêòèâíûå òî÷êè óøíîé ðàêîâèíû, óñòàíàâëèâàåòñÿ íà äëèòåëüíîå âðåìÿ. Â èòîãå ïîäàâëÿåòñÿ àïïåòèò. Ìîçã ïîëó÷àåò ñèãíàë, ÷òî ÷åëîâåê ñûò. ÏÐÅÈÌÓÙÅÑÒÂÀ ÄÀÍÍÎÃÎ ÌÅÒÎÄÀ: Ñàìûé äîñòóïíûé è íåäîðîãîé ìåòîä ïîõóäåíèÿ. Âû èçáàâèòåñü îò ïðîáëåìíûõ çîí. Ñíèæåíèå âåñà îò 3 äî 10 êã çà îäèí ìåñÿö. Ïîäàâëÿåòñÿ ÷óâñòâî ãîëîäà è àïïåòèò. Ïîõóäåòü ëåãêî Âû ïîñåùàåòå ñïåöèàëèñòà âñåãî 1 ðàç. Âàì íå ïðèäåòñÿ çàíèìàòüñÿ ñïîðòîì è ïðèíèìàòü òàáëåòêè. Ïîñëå îêîí÷àíèÿ êóðñà âåñ íå íàáèðàåòñÿ. Äåéñòâåííîñòü äàííîãî ñïîñîáà çàâèñèò îò ñòðîåíèÿ æèðîâîé òêàíè, íàñëåäñòâåííîé ñêëîííîñòè, îñîáåííîñòåé îðãàíèçìà, è â êàæäîì ñëó÷àå îïðåäåëÿåòñÿ ïåðñîíàëüíî. Óçíàéòå ïîäðîáíîñòè ïî òåëåôîíàì!!! Íàø íîìåð òåëåôîíà (495) 739`34_39 â ëþáîå âðåìÿ ìåòðî Òóøèíñêàÿ, óë. Ìèòèíñêàÿ, ä.43, ì-í Ìèòèíî Ñò.Ì. «Ëþáëèíî» (100 ì îò ìåòðî), óë. Íîâîðîññèéñêàÿ, ä.28 [[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] dmnorm not meant for 1024-dimensional data?

Hello, I have some data generated by a simple mixture of Gaussians (more like K-means) and (as a test) am using dmnorm to calculate the probability of each data point coming from each Gaussian. However, I get only zero probabilities. This code works in low dimensions (tried 2 and 3 already). I have run into many implementations that do not work in high dimension, but I thought that I was safe with dmnorm because it has an option to compute the log of the probability. So, is dmnorm not intended to be used with data of such high dimensionality? Thank you, dan elliott __ 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] negative number to positive number

Quoting H. Paul Benton [EMAIL PROTECTED]: Hello all, I know this is a pretty easy question but I can't find it in S poetry or R help. How can I make a negative number positive. Such as -5 to be +5 I tried +(-5), but that didn't work. So no, I don't mean taking a -5^2 just to get a positive number. This is in a function so it's not just -5 it's x. :) Thanks, Paul how about just multiplying it by -1??? :-) -5*(-1) Jose -- Dr. Jose I. de las Heras Email: [EMAIL PROTECTED] The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374 Institute for Cell Molecular BiologyFax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK __ 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 on 'find.BIB' function

Hello everyone, I am trying to use the 'find.BIB' function to construct a balanced incomplete block design. When I ran the example given in the help file (find.BIB(10,30,4)), I obtained the following error message: Error in optBlock(~., withinData = factor(1:trt), blocksize = rep(k, b)) : object .Random.seed not found I investigated what the optBlock function is doing but the manual / help files did not give me any information regarding the above error. I hope somebody can help me regarding this matter. Best regards, Jason Parcon - [[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] barchart producing incorrect number of barcharts when columns renamed

On 4/25/07, Colm G. Connolly [EMAIL PROTECTED] wrote: Hi everybody, I'm having problems with the barchart command in the lattice package. [... ... ...] __ 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. You seem to have missed this footer that appears in every r-help message. Your code is not reproducible, and not minimal by a long, long, shot. -Deepayan __ 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] Help on 'find.BIB' function

Jason Parcon wrote: Hello everyone, I am trying to use the 'find.BIB' function to construct a balanced incomplete block design. When I ran the example given in the help file (find.BIB(10,30,4)), I obtained the following error message: Error in optBlock(~., withinData = factor(1:trt), blocksize = rep(k, b)) : object .Random.seed not found I investigated what the optBlock function is doing but the manual / help files did not give me any information regarding the above error. I hope somebody can help me regarding this matter. The following seems to work for me: library(crossdes) Loading required package: AlgDesign Loading required package: gtools Loading required package: MASS set.seed(671969) find.BIB(10,30,4) [,1] [,2] [,3] [,4] [1,]457 10 [2,]123 10 [3,]156 10 [4,]289 10 [5,]3567 [6,]349 10 [7,]1589 [8,]1679 [9,]1247 [10,]268 10 [11,]2357 [12,]1679 [13,]267 10 [14,]1239 [15,]2568 [16,]2459 [17,]3468 [18,]158 10 [19,]2478 [20,]369 10 [21,]1246 [22,]378 10 [23,]2359 [24,]145 10 [25,]4689 [26,]479 10 [27,]1378 [28,]3456 [29,]5789 [30,]1348 I get the same error you report if I don't do the set.seed() step. sessionInfo() R version 2.4.1 Patched (2007-03-31 r41127) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods [7] base other attached packages: crossdes MASSgtools AlgDesign 1.0-7 7.2-33 2.3.1 1.0-7 Best regards, Jason Parcon - [[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. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ 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

Hi, Would anyone know how to calculate the modal value of LeafArea? Thank-you very much!! Nat __ Hi all, I have 2 questions: 1)How do I calculate the mean on an imported txt file? I've imported the file below and that's what it looks like imported. How do I then calcuate the mean, median, or mode on the column LeafArea using the desktop R package? Any help would be greatly appreciated!! Thanks, Nat LeafType Leaflets LeafArea ShapeRatio LeafWeight LeafThickness 1 13 0.12 0.12 0.21 0.00 2 13 0.17 0.17 0.36 0.00 3 13 0.21 0.05 0.47 0.16 4 13 0.11 0.14 0.23 0.21 5 23 0.03 0.27 0.16 0.60 6 23 0.08 0.20 0.15 0.75 7 23 0.22 0.05 0.24 1.09 8 23 0.20 0.10 0.26 1.30 9 23 0.18 0.10 0.33 1.33 1023 0.14 0.07 0.19 1.36 1123 0.16 0.13 0.22 1.38 1223 0.18 0.06 0.25 1.39 1323 0.05 0.00 0.07 1.40 1423 0.11 0.01 0.21 1.41 1523 0.22 0.04 0.31 1.41 1623 0.09 0.10 0.13 1.44 1723 0.09 0.10 0.13 1.44 1823 0.13 0.08 0.19 1.46 1923 0.15 0.13 0.22 1.47 2023 0.15 0.03 0.22 1.47 2123 0.21 0.01 0.31 1.48 2213 0.21 0.14 0.32 1.50 2323 0.10 0.00 0.15 1.50 2413 0.26 0.60 0.40 1.53 2523 0.12 0.18 0.20 1.54 2623 0.20 0.15 0.31 1.55 2713 0.19 0.16 0.31 1.60 2813 0.13 0.00 0.21 1.62 2913 0.13 0.01 0.21 1.62 3013 0.37 0.27 0.60 1.62 3123 0.11 0.09 0.18 1.64 3223 0.14 0.00 0.23 1.64 3323 0.15 0.08 0.21 1.64 3423 0.20 0.10 0.33 1.65 3523 0.15 0.01 -0.25 1.67 3623 0.17 0.06 0.29 1.67 3723 0.13 0.08 0.22 1.69 3813 0.16 0.31 0.27 1.70 3913 0.21 0.01 0.40 1.70 4013 0.14 0.07 0.29 1.71 4123 0.14 0.00 0.24 1.71 4223 0.21 0.14 0.35 1.71 4323 0.11 0.09 0.19 1.73 4423 0.15 0.01 0.26 1.73 4523 0.19 0.11 0.33 1.74 4610 0.28 0.27 0.50 1.79 4713 0.10 0.01 0.18 1.80 4823 0.05 0.00 0.09 1.80 4913 0.12 0.11 0.22 1.83 5013 0.20 0.05 0.37 1.85 5123 0.14 0.14 0.26 1.86 5213 0.15 0.07 0.28 1.87 5313 0.15 0.01 0.28 1.87 5423 0.12 0.08 0.23 1.92 5523 0.15 0.00 0.29 1.93 5613 0.17 0.00 0.34 2.00 5713 0.21 0.02 0.42 2.00 5823 0.13 0.08 0.26 2.00 5913 0.16 0.06 0.32 2.05 6013 0.14 0.14 0.29 2.07 6123 0.12 0.08 0.25 2.08 6213 0.17 0.06 0.36 2.12 6313 0.13 0.08 0.28 2.13 6413 0.20 0.10 0.43 2.15 6513 0.26 0.08 0.56 2.15 6613 0.20 0.10 0.44 2.20 6713 0.19 0.11 0.42 2.21 6813 0.08 0.00 0.18 2.25 691

### Re: [R] negative number to positive number

?abs Clint BowmanINTERNET: [EMAIL PROTECTED] Air Dispersion Modeler INTERNET: [EMAIL PROTECTED] Air Quality Program VOICE: (360) 407-6815 Department of Ecology FAX:(360) 407-7534 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels:300 Desmond Drive, Lacey, WA 98503-1274 On Wed, 25 Apr 2007 [EMAIL PROTECTED] wrote: Quoting H. Paul Benton [EMAIL PROTECTED]: Hello all, I know this is a pretty easy question but I can't find it in S poetry or R help. How can I make a negative number positive. Such as -5 to be +5 I tried +(-5), but that didn't work. So no, I don't mean taking a -5^2 just to get a positive number. This is in a function so it's not just -5 it's x. :) Thanks, Paul how about just multiplying it by -1??? :-) -5*(-1) Jose -- Dr. Jose I. de las Heras Email: [EMAIL PROTECTED] The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374 Institute for Cell Molecular BiologyFax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK __ 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] Problem installing Rmpi with lam on SGI SLES9

On 25/04/07, Martin Morgan [EMAIL PROTECTED] wrote: Hendrik Fuß [EMAIL PROTECTED] writes: I'm trying to use the papply package. However, when I do: library(papply) papply(list(1:10, 1:15, 1:20), sum) 1 slaves are spawned successfully. 0 failed. master (rank 0, comm 1) of size 2 is running on: behemoth slave1 (rank 1, comm 1) of size 2 is running on: behemoth [1] Running serial version of papply\n Papply only spawns one slave and then decides to run the serial version instead. I'm not sure how to tell it to use all the 64 processors available. Hendrik, Are you starting the lam daemons before starting R? % lamboot You might need to specify a 'hosts' argument to lamboot. The default way Rmpi calls lamboot is with no arguments, and this might simply create a single lam daemon. Thanks, that was a pointer in the right direction. The solution is to edit the file /etc/lam/lam-bhost.def and specify the number of cpus (see man bhost) cheers Hendrik -- Hendrik Fuß PhD student Systems Biology Research Group University of Ulster, School of Biomedical Sciences Cromore Road, Coleraine, BT52 1SA, Northern Ireland __ 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] GLS terminology question not related to R

Thomas Lumley wrote: On Wed, 25 Apr 2007, Leeds, Mark (IED) wrote: This is a terminology question not related to R. The literature often says that OLS is inefficient relative to GLS if the residuals in the system are correlated ( and the RHS sides of each are not identical ). Does this mean that OLS overestimates residual and coefficient variances , underestimates them or just gets them wrong and the direction is not known ? Thanks. It does not mean either. It means that the true variance of the OLS estimates is greater than the true variance of the GLS estimates. Yes, and to complicate things further that is not necessarily true if many parameters go into determining the variances and covariances necessary for GLS. (Cue recent discussion comparing T^2 and F tests). A separate issue is whether the estimated variance of an OLS estimator is greater or less than the true variance of the OLS estimator. This can go either way. __ 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] Fwd: dmnorm not meant for 1024-dimensional data?

On Wed, Apr 25, 2007 at 01:25:09PM -0500, Daniel Elliott wrote: Hello. Thank you for your mnormt package. Below is an email I sent to R-help regarding the function dmnorm. Any help you can provide would be greatly appreciated. Hello. You have not provided information on what specifically you have tried as for parameters and evaluation points, so I have chosen a particularly simple case, namely the 1024-dimensional density with independent standard marginals, using this code d- 1024 x - 1 const- 0.5*log(2*pi) log.pdf -0 for (i in 1:d) log.pdf - log.pdf - x^2/2 -const # S - diag(d) mu- rep(0,d) X - rep(x,d) log.pdf2 - dmnorm(X,mu,S, log=TRUE) cat(log.pdf, log.pdf2, abs(log.pdf-log.pdf2),\n) and the outcome was this one: -1453 -1453 2.137e-11 which seems quite decent to me. Obviously, you must not take exp() of this log-density, as otherwise a 0 is indeed produced, but the reason is not in the package, rather in the possibility of representing that number using standard floating-point numerical devices. best regards, Adelchi Azzalini Thank you. - dan elliott -- Forwarded message -- From: Daniel Elliott [EMAIL PROTECTED] Date: Apr 25, 2007 1:21 PM Subject: dmnorm not meant for 1024-dimensional data? To: r-help@stat.math.ethz.ch Hello, I have some data generated by a simple mixture of Gaussians (more like K-means) and (as a test) am using dmnorm to calculate the probability of each data point coming from each Gaussian. However, I get only zero probabilities. This code works in low dimensions (tried 2 and 3 already). I have run into many implementations that do not work in high dimension, but I thought that I was safe with dmnorm because it has an option to compute the log of the probability. So, is dmnorm not intended to be used with data of such high dimensionality? Thank you, dan elliott -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia tel. +39 049 8274147, http://azzalini.stat.unipd.it/ __ 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] applying rbind to list elements

Hi, I have a list of n data.frames (or matrices) which I would like to convert to a single data.frame using rbind: x - rbind( l[[1]], l[[2]], l[[3]], l[[4]], ..., l[[n]] ) Is there a simple way to do this? thanks Hendrik -- Hendrik Fuß PhD student Systems Biology Research Group University of Ulster, School of Biomedical Sciences Cromore Road, Coleraine, BT52 1SA, Northern Ireland __ 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] applying rbind to list elements

On 4/25/2007 4:09 PM, Hendrik Fuß wrote: Hi, I have a list of n data.frames (or matrices) which I would like to convert to a single data.frame using rbind: x - rbind( l[[1]], l[[2]], l[[3]], l[[4]], ..., l[[n]] ) Is there a simple way to do this? do.call(rbind, l). Duncan Murdoch __ 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] applying rbind to list elements

I knew there would be a simple solution. thanks everybody. On 25/04/07, Duncan Murdoch [EMAIL PROTECTED] wrote: On 4/25/2007 4:09 PM, Hendrik Fuß wrote: Hi, I have a list of n data.frames (or matrices) which I would like to convert to a single data.frame using rbind: x - rbind( l[[1]], l[[2]], l[[3]], l[[4]], ..., l[[n]] ) Is there a simple way to do this? do.call(rbind, l). Duncan Murdoch -- Hendrik Fuß PhD student Systems Biology Research Group University of Ulster, School of Biomedical Sciences Cromore Road, Coleraine, BT52 1SA, Northern Ireland __ 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] levelplot and unequal cell sizes

Hadley and Deepayan, Thank you for responding. Here is a simple example of what I'm talking about. It is a grid that is 5 cells wide by 2 cells tall. The width of the cells in the x-direction is variable; the cells at either end have width = 4 units, and the three cells in the middle have width = 2 units. My objective is to have the color contour boundaries fall on the cell boundaries instead of equidistant between cell nodes. In the plot, I want the cyan/blue and orange/gray boundaries to be located at the red cell boundary lines. Also, the colored regions should extend to the ends of the domain (x = 0, 14). library(lattice) x.node - rep(c(2, 5, 7, 9, 12), 2) y.node - c(rep(0.5, 5), rep(1.5, 5)) z - rep(1:5, 2) contour.levels - seq(0.5, 5.5, by=1) x.cell.boundary - c(0, 4, 6, 8, 10, 14) contour.colors - c(cyan, blue, green, orange, gray) print( levelplot(z ~ x.node * y.node, panel = function(z,...) { panel.levelplot(z,...) panel.abline(v = x.cell.boundary, col=red) }, xlim = range(x.cell.boundary), at=contour.levels, colorkey = list(space=top, width=1, height=0.9, at=1:5, col=contour.colors, labels=list(labels=z, at=z) ), col.regions=contour.colors, region = T, contour = F ) ) Any help you can offer is appreciated. Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler _at_ pnl.gov http://hydrology.pnl.gov __ 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] dist label names

Hello, I am trying to do a multi-dimensional scaling of the World Bank's quality of governance indicators for the Balkan region. I am having trouble labelling my plot. Could some kind person help me out. How do I set the attribute Label by a variable (say, Code)? At present I get this: qog.dist-dist(Balkans.data, method = euclidean, diag = FALSE, upper = FALSE) labels(qog.dist) [1] 1 2 3 4 5 6 7 8 9 10 I know this must be a really basic questions, but none of the 5-6 books on my shelf nor a web search have proved much help. In case you hadn't guessed, I am pretty new to R. Lindsay __ 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] applying rbind to list elements

do.call(rbind, l) or, in the case of matrices, using the abind package: abind(l, along=1) library(abind) l - list(matrix(1:6, ncol=2), matrix(11:14, ncol=2)) abind(l, along=1) [,1] [,2] [1,]14 [2,]25 [3,]36 [4,] 11 13 [5,] 12 14 Hendrik Fuß wrote: Hi, I have a list of n data.frames (or matrices) which I would like to convert to a single data.frame using rbind: x - rbind( l[[1]], l[[2]], l[[3]], l[[4]], ..., l[[n]] ) Is there a simple way to do this? thanks Hendrik __ 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] Sum of specific column

I have a data set that I have imported (not sure if that makes a difference) and I would like to calculate the sum of only specific columns. I have tried colSums(dataset, by=list(dataset$col5), dims=1) and I get an error of unused arguments I have also tried aggregate(dataset, by=list(dataset$col5), sum) and I get the error that sum is not meaningful for factors. I want to only calculate the sum for specific columns because some of the columns have words in them and I have not been able to find anything else that would help or why these errors are occuring. Jacquie [[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] aggregate similar to SPSS

Hi, Does anyone know if: with R can you take a set of numbers and aggregate them like you can in SPSS? For example, could you calculate the percentage of people who smoke based on a dataset like the following: smoke = 1 non-smoke = 2 variable 1 1 1 2 2 1 1 1 2 2 2 2 2 2 When aggregated, SPSS can tell you what percentage of persons are smokers based on the frequency of 1's and 2's. Can R statistical package do a similar thing? Thanks, Nat __ 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] levelplot and unequal cell sizes

On 4/25/07, Waichler, Scott R [EMAIL PROTECTED] wrote: Hadley and Deepayan, Thank you for responding. Here is a simple example of what I'm talking about. It is a grid that is 5 cells wide by 2 cells tall. The width of the cells in the x-direction is variable; the cells at either end have width = 4 units, and the three cells in the middle have width = 2 units. My objective is to have the color contour boundaries fall on the cell boundaries instead of equidistant between cell nodes. In the plot, I want the cyan/blue and orange/gray boundaries to be located at the red cell boundary lines. Also, the colored regions should extend to the ends of the domain (x = 0, 14). library(lattice) x.node - rep(c(2, 5, 7, 9, 12), 2) y.node - c(rep(0.5, 5), rep(1.5, 5)) z - rep(1:5, 2) contour.levels - seq(0.5, 5.5, by=1) x.cell.boundary - c(0, 4, 6, 8, 10, 14) contour.colors - c(cyan, blue, green, orange, gray) print( levelplot(z ~ x.node * y.node, panel = function(z,...) { panel.levelplot(z,...) panel.abline(v = x.cell.boundary, col=red) }, xlim = range(x.cell.boundary), at=contour.levels, colorkey = list(space=top, width=1, height=0.9, at=1:5, col=contour.colors, labels=list(labels=z, at=z) ), col.regions=contour.colors, region = T, contour = F ) ) You are right, panel.levelplot is indeed assuming that the boundaries are between consecutive midpoints. There is no built in way around that; there simply isn't enough information available to the panel function. The cleanest solution, in principle, is to write your own panel function that ends up calling panel.polygon or grid.polygon. panel.levelplot is a good starting point (the only tricky part is getting the colors right, almost everything else you can get rid of). Maybe Hadley will have a simpler solution. Here's a possible implementation using a panel function: my.panel.levelplot - function (x, y, z, subscripts, at = pretty(z), col.regions = regions$col, ..., w, h) { regions - trellis.par.get(regions) numcol - length(at) - 1 numcol.r - length(col.regions) col.regions - if (numcol.r = numcol) rep(col.regions, length = numcol) else col.regions[floor(1+(1:numcol-1) * (numcol.r-1)/(numcol-1))] zcol - findInterval(z, at, rightmost.closed = TRUE) x - as.numeric(x[subscripts]) y - as.numeric(y[subscripts]) z - as.numeric(z[subscripts]) w - as.numeric(w[subscripts]) h - as.numeric(h[subscripts]) zcol - as.numeric(zcol[subscripts]) print(data.frame(z, x.node, y.node, w.node, h.node, col.regions[zcol])) panel.rect(x = x, y = y, width = w, height = h, col = col.regions[zcol], ...) } x.node - rep(c(2, 5, 7, 9, 12), 2) y.node - c(rep(0.5, 5), rep(1.5, 5)) z - rep(1:5, 2) contour.levels - seq(0.5, 5.5, by=1) x.cell.boundary - c(0, 4, 6, 8, 10, 14) contour.colors - c(cyan, blue, green, orange, gray) w.node - rep(diff(x.cell.boundary), 2) h.node - rep(1, 10) levelplot(z ~ x.node * y.node, h = h.node, w = w.node, panel = function(...) { my.panel.levelplot(...) panel.abline(v = x.cell.boundary, col=red) }, xlim = range(x.cell.boundary), at=contour.levels, colorkey = list(space=top, width=1, height=0.9, at=contour.levels, col=contour.colors, labels=list(labels=z, at=z)), col.regions=contour.colors) -Deepayan __ 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] Biostatistician Opportunities at Vanderbilt

The Department of Biostatistics at Vanderbilt University's School of Medicine has openings for biostatisticians at all levels. Details and application procedures may be found at http://biostat.mc.vanderbilt.edu/JobOpenings . For M.S. and B.S. biostatisticians we are especially interested in statisticians proficient in R, S-Plus, or Stata. We have faculty positions available at the Assistant, Associate, and Professor levels. Frank Harrell Chairman, Dept. of Biostatistics __ 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 similar to SPSS

?table On Wednesday 25 April 2007 14:32, Natalie O'Toole wrote: Hi, Does anyone know if: with R can you take a set of numbers and aggregate them like you can in SPSS? For example, could you calculate the percentage of people who smoke based on a dataset like the following: smoke = 1 non-smoke = 2 variable 1 1 1 2 2 1 1 1 2 2 2 2 2 2 When aggregated, SPSS can tell you what percentage of persons are smokers based on the frequency of 1's and 2's. Can R statistical package do a similar thing? Thanks, Nat __ 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. -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341 __ 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 similar to SPSS

Hi Nat, can I suggest, without offending, that you purchase and read Peter Dalgaard's Introductory Statistics with R or Michael Crawley's Statistics: An Introduction using R or Venables and Ripley's Modern Applied Statistics with S or Maindonald and Braun's Data Analysis and Graphics Using R: An Example-based Approach, or download and read An Introduction to R http://cran.r-project.org/doc/manuals/R-intro.pdf or one of the numerous contributed documents at http://cran.r-project.org/other-docs.html ? I hope that this helps, Andrew. On Wed, Apr 25, 2007 at 03:32:11PM -0600, Natalie O'Toole wrote: Hi, Does anyone know if: with R can you take a set of numbers and aggregate them like you can in SPSS? For example, could you calculate the percentage of people who smoke based on a dataset like the following: smoke = 1 non-smoke = 2 variable 1 1 1 2 2 1 1 1 2 2 2 2 2 2 When aggregated, SPSS can tell you what percentage of persons are smokers based on the frequency of 1's and 2's. Can R statistical package do a similar thing? Thanks, Nat __ 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. -- Andrew Robinson Department of Mathematics and StatisticsTel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/ __ 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] ANOVA results in R conflicting with results in other software packages

Hi, I'm wrestling with an analysis of a dataset, which I previously analyzed in SYSTAT, but am now converting to R and was doing a re-analysis. I noticed, however, that the same model yields different results (different sums of squares) from the two programs. I first thought this might be because the two programs use different calculations to get the sums of squares, but the problem persisted even after I specified type III sums of squares. Can anyone help me by clarifying why there is this discrepancy? The data table is: hostsize2 maladaptincrease A yes 35 21 A yes 30 13 A no 73 -6 A yes 22 3 C yes 19 -1 A no 53 1 C no 48 -27 A yes 32 26 A yes 14 1 A no 83 42 A yes 19 -3 A no 66 -7 C no 69 -14 A yes 30 30 C no 69 -22 A yes 10 6 C no 65 -15 A yes 11 4 A yes 15 15 A no 77 30 C yes 11 11 A no 48 -4 C yes 29 -4 A yes 0 0 C no 69 -2 A yes 10 -40 C yes 8 -6 C no 91 -2 C no 65 13 A yes 12 0 C yes 16 -26 C yes 38 -12 A no 43 20 C no 81 -7 A yes 9 9 C no 100 25 A yes 18 12 C yes 27 -6 A yes 11 -3 The dialogue in R is as follows: library(car) read.table(file=/Users/lukeharmon/Desktop/glmnosil.txt, header=T)-nn attach(nn) ls(2) [1] host increase maladapt size2size4 lm(maladapt~host*increase*size2) Call: lm(formula = maladapt ~ host * increase * size2) Coefficients: (Intercept)hostC increase size2yes 59.54144 17.13828 0.34487-44.41381 hostC:increase hostC:size2yes increase:size2yes hostC:increase:size2yes 0.30449-12.50558 0.03766 -0.90697 lm(maladapt~host*increase*size2)-fm Anova(fm, type=III) Anova Table (Type III tests) Response: maladapt Sum Sq Df F valuePr(F) (Intercept) 18348.5 1 152.9683 1.595e-13 *** host 920.9 1 7.6774 0.009366 ** increase 278.4 1 2.3210 0.137773 size27447.0 1 62.0841 6.806e-09 *** host:increase 105.1 1 0.8758 0.356584 host:size2266.9 1 2.2252 0.145880 increase:size2 2.0 1 0.0171 0.896902 host:increase:size2 332.3 1 2.7703 0.106108 Residuals3718.4 31 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Contrast this with the results from SYSTAT SourceSum-of-SquaresdfMean-SquareF-ratioP HOST$808.9491808.9496.7440.014 SIZE2$17525.418117525.418146.1060.000 INCREASE540.5791540.5794.5070.042 SIZE2$*HOST$266.9151266.9152.2250.146 SIZE2$*INCREASE279.3891279.3892.3290.137 HOST$*INCREASE35.869135.8690.2990.588 SIZE2$*HOST$*INCREASE332.2931332.2932.7700.106 Error3718.44131119.950 I've been trying to find anything in the documentation for anova() that would give a default that is different from what is in SYSTAT, but part of the problem is that SYSTAT is somewhat opaque as to its calculations, so it is hard to contrast the two. I would really really welcome feedback as to what may cause this discrepancy. Thanks very much for your help, Dan Bolnick Section of Integrative Biology University of Texas at Austin [[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.