Re: [R] Cholesky Decomposition
Dear Kolluru For a real symmetric positive-definite square matrix you can use chol (see ?chol) in the base package. help.search(cholesky) gives some more alternatives: chol.new(assist)A Modified Cholesky Decomposition chol.reduce(kernlab)Incomplete Cholesky decomposition gchol(kinship) Generalized Cholesky decompostion solve.bdsmatrix(kinship) Solve a matrix equation using the generalized Cholesky decompostion solve.gchol(kinship)Solve a matrix equation using the generalized Cholesky decompostion Cholesky-class(Matrix) Cholesky decompositions sscChol-class(Matrix) Cholesky decompositions of sscMatrix objects chol(base) The Choleski Decomposition chol2inv(base) Inverse from Choleski Decomposition Hope there is something for you. Christoph -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C11 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-5414 fax: 632-1228 http://stat.ethz.ch/~buser/ kolluru ramesh writes: Can we do Cholesky Decompositon in R for any matrix - [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] memory and swap space in ncdf
I've a linux system with 2Gb of memory which is not enough for reading a 446Mb netcdf file using ncdf: library(ncdf) ncold - open.ncdf(gridone.grd) Error: cannot allocate vector of size 1822753 Kb When I look at the free memory in my system I can see that none of the Swap space is being used by R. I am a newbie in linux and R, I've read the Memory help pages but still have some questions: can I use the swap space in R to solve my problem of lack of memory? if not, are there any ways to read the data apart from buying more RAM? Thanks, M __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Selecting a subplot of pairs
Hello, I'm trying to plot a set of 3 dependant variables (y) against 4 predictors (x) in a matrix-like plot, sharing x- an y-axis for all the plot on the same column/line : y1/x1 y1/x2 y1/x3 y1/x4 y2/x1 y2/x2 y2/x3 y2/x4 y3/x1 y3/x2 y3/x3 y3/x4 In fact, this plot is a rectangular selection of the result of pairs(), limited to the relations between x's and y's and excluding those within x's and y's. I managed to recreate such a plot using a script with layout(), axis() and so on, but I was wondering if there already exists a clean function for such a task, in case I would encounter this problem again ? -- Ir. Yves BROSTAUX Unité de Statistique et Informatique Faculté universitaire des Sciences agronomiques de Gembloux (FUSAGx) 8, avenue de la Faculté B-5030 Gembloux Belgique Tél: +32 81 62 24 69 Email: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Parallel computations using snow: how to combine boot objects?
Hello, I'm trying to do some bootstrapping in a parallel environment (Linux cluster) in order to estimate confidence intervals for a certain parameter. Following the example in the documentation of the snow package (http://www.stat.uiowa.edu/~luke/R/cluster/cluster.html), I launch my computations by something like cl.nuke.boot - + clusterCall(cl,boot,nuke.data, nuke.fun, R=500, m=1, + fit.pred=new.fit, x.pred=new.data) which gives me a list of n boot objects (where n is the number of nodes in my cluster). So far, so good. However, if I now want to go further, I need to combine all these boot objects to a single one which I can pass to boot.ci for example. Is there a recommended way to do this? Thanks, Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] gsub pattern?
Hi, search in web for regular expressions i get the information that the line below replace all AUTO string's like AUTOBAHN ,AUTORENNEN with 1 but nothing happend. Using the [] in the pattern it works like i'm expected, but i didn't want single character replacment. Where is my mistake? bcode - gsub(/^AUTO.*/,1,MyStringVector,ignore.case=T,extended=T) many thanks regards, christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Slow R Graphics: Device 2 within Xemacs/Ess
Dear R-list, I use Xemacs 21.4.13 with Ess, R 2.0.1, and Win XP. When i plot something it shows up OK in the graphics window but when I want to change between windows in the foreground (between Xemacs and R Graphics: Device) the graphics window is awfully slow to redraw when forced to the foreground. When I use Rgui this is not any problem at all so it appears to be something wrong between Xemacs and R. (Ess and R work very well in Xemacs from other aspects) Any hints how to tweak the programs to each other? Best wishes Fredrik Lundgren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gsub pattern?
Christian Schulz wrote: Where is my mistake? bcode - gsub(/^AUTO.*/,1,MyStringVector,ignore.case=T,extended=T) You dont need the slashes! You've been looking at documentation for Perl regular expression replacements, I guess. help(gsub) may have showed you the way. Here's how to do it: MyStringVector=c(AUTOBAHN,NAUTON,FOO,AUTOGRAPH) # wrong way: gsub(/^AUTO.*/,1,MyStringVector,ignore.case=T,extended=T) [1] AUTOBAHN NAUTONFOO AUTOGRAPH # dont slash all over the regexp: gsub(^AUTO.*,1,MyStringVector,ignore.case=T,extended=T) [1] 1 NAUTON FOO1 Is that what you're after? Baz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gsub pattern?
Christian Schulz [EMAIL PROTECTED] writes: Hi, search in web for regular expressions i get the information that the line below replace all AUTO string's like AUTOBAHN ,AUTORENNEN with 1 but nothing happend. Using the [] in the pattern it works like i'm expected, but i didn't want single character replacment. Where is my mistake? bcode - gsub(/^AUTO.*/,1,MyStringVector,ignore.case=T,extended=T) What are the /-es for? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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
[R] axis placement with stacked barplots and the asp=1 parameter
Hi, I'm currently using barplot to generate vertically stacked bar charts. I'd like to be able to use the asp=1 parameter with barplot(), but doing this causes the y axis to be placed on the far left as shown in the attachment demo.pdf. I could get around this by using the negative values for the line parameter of the axis() function. I'd rather not do this and imagine I'm doing something wrong. Any help would be much appreciated. Thanks Kav --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. The Prytania Group has taken every reasonable precaution to ensure that any attachment to this e-mail has been swept for viruses. However, we cannot accept liability for any damage sustained as a result of software viruses and would advise that you carry out your own virus checks before opening any attachment. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gsub pattern?
many thanks ..the different styles from linux to r-project a little confusing for me :-( christian Peter Dalgaard wrote: Christian Schulz [EMAIL PROTECTED] writes: Hi, search in web for regular expressions i get the information that the line below replace all AUTO string's like AUTOBAHN ,AUTORENNEN with 1 but nothing happend. Using the [] in the pattern it works like i'm expected, but i didn't want single character replacment. Where is my mistake? bcode - gsub(/^AUTO.*/,1,MyStringVector,ignore.case=T,extended=T) What are the /-es for? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] cross validation
How to select training data set and test data set from the original data for performing cross-validation - [[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
[R] an R script editor for Mac
Dear all, Could someone please make me know if there is a nice script editor available under Mac, similar to Crimson, that offers R syntax highlighting (and pairs of parentheses underlining) ? Thanks in advance, Jacques VESLOT Cirad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Average disjunction
Dear All after performing a test like TukeyHSD is there a simple/complicated way to perform average disjunction with letter? example 10 aA 6 bA 1.5 cB 2 cB 1 cB Thanks - Landini dr. Massimiliano Tel. mob. (+39) 347 140 11 94 Tel./Fax. (+39) 051 762 196 e-mail: numero (dot) primo (at) tele2 (dot) it - Legge di Hanggi: Più stupida è la tua ricerca, più verrà letta e approvata. Corollario alla Legge di Hanggi: Più importante è la tua ricerca, meno verrà capita. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dim vs length for vectors
On Friday 21 January 2005 06:35, Gabor Grothendieck wrote: In R, vectors are not arrays: R v - 1:4 R dim(v) NULL R is.array(v) [1] FALSE R a - array(1:4) R dim(a) [1] 4 R is.array(a) [1] TRUE Is this a feature which is useful in some applications? IMHO the difference between vectors and 1-dimensional arrays is really annoying and I had already several bugs in my code, because I mixed these up. Is it possible in future versions of R that R does not differentiate between vectors and 1-dimensional arrays (e.g. by treating all vectors as 1-dimensional arrays)? Arne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] cross validation
you could something like this (based on VR's S Programming, pp. 175): dat - data.frame(matrix(rnorm(100*6), 100, 6)) # n - nrow(dat) V - 10 # number of folds samps - sample(rep(1:V, length=n), n, replace=FALSE) # # Using the first fold: train - dat[samps!=1,] # fit the model test - dat[samps==1,] # predict I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: kolluru ramesh [EMAIL PROTECTED] To: Rpackage help r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 11:19 AM Subject: [R] cross validation How to select training data set and test data set from the original data for performing cross-validation - [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] an R script editor for Mac
You could look at http://www.r-project.org/GUI/projects/Editors.html for a list of text editors offering, at least, syntax highlighting of R code. For Mac (OS X), it seems you have the choice between SubEthaEdit, BlueFish and Jedit,... plus the code editor included in JGR (see: http://stats.math.uni-augsburg.de/JGR/). Best, Philippe Grosjean ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) ( ( ( ( (Academie Universitaire Wallonie-Bruxelles ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium ( ( ( ( ( ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 ( ( ( ( (email: [EMAIL PROTECTED] ) ) ) ) ) ( ( ( ( (web: http://www.umh.ac.be/~econum ) ) ) ) ) http://www.sciviews.org ( ( ( ( ( .. Jacques VESLOT wrote: Dear all, Could someone please make me know if there is a nice script editor available under Mac, similar to Crimson, that offers R syntax highlighting (and pairs of parentheses underlining) ? Thanks in advance, Jacques VESLOT Cirad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] chi-Squared distribution
Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna Prasanna Balaprakash, Université Libre de Bruxelles, 50, Av. F. Roosevelt, CP 194/6, B-1050 Brussels, Belgium. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] cross validation
One way is to create an indicator vector that indicate which `fold' a case should belong to. Something like: fold - 10 idx - sample(fold, n, replace=TRUE) for (I in 1:fold) { train.dat - dat[idx != i,] test.dat - dat[idx == i,] ... } Also see the errorest() function in the ipred package. It is more careful in making sure the folds are as close in size as possible, and can do stratified splits. Andy From: kolluru ramesh How to select training data set and test data set from the original data for performing cross-validation - [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] mixed effects model:how to include initial conditions
Dear R users, I am analyzing a dataset on growth of plants in response to several factors. I am using a mixed-effects model of the following structure: model-lme(growth~block*treatment*factor1*factor2, random=~1|plot/treatment/initialsize) I have measured the initial size of the plants (in 2003) and thought it might be sensible to include this (random) variation into the random effects term of the model. Is that correct? Or should initialsize rather be included as a covariate into the fixed effects term, as in: alternative-lme(growth~block*initialsize*treatment*factor1*factor2, random=~1|plot/treatment) I would very much appreciate any suggestions on how to analyze these data correctly. Best regards Chris. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: chi-Squared distribution
Hi, Attention chi-squared distribution, unlike F distribution, has only df1 as parameter, not df1 and df2. So correct into: outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1)) Regards, Vito you wrote: Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna = Diventare costruttori di soluzioni Became solutions' constructors The business of the statistician is to catalyze the scientific learning process. George E. P. Box Top 10 reasons to become a Statistician 1. Deviation is considered normal 2. We feel complete and sufficient 3. We are 'mean' lovers 4. Statisticians do it discretely and continuously 5. We are right 95% of the time 6. We can legally comment on someone's posterior distribution 7. We may not be normal, but we are transformable 8. We never have to say we are certain 9. We are honestly significantly different 10. No one wants our jobs Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/palese/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] functions not found after installing DBI/RDBI packages
Colin, Rdbi provides generic methods for working with databases. It requires a driver for a specific database, as well. Therefore, you will need to download and install RdbiPgSQL, also. Sean On Jan 21, 2005, at 4:58 AM, Combe, Colin wrote: Hi, I would like to be able to use R with a connection to a PostgreSQL database. I am using R 2.0.1 on windows XP. I have tried installing both the DBI and rDBI packages (which is better?) but in either case I run into the same problem - when i try to use either the dbDriver or dbConnect functions i'm told the function couldn't be found. Seems like the packages aren't installing properly. I installed DBI from a zip file and rDBI from bioconductor. Any clues as to where i'm going wrong? thanks, colin [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] cross validation
Dimitris Rizopoulos wrote: you could something like this (based on VR's S Programming, pp. 175): dat - data.frame(matrix(rnorm(100*6), 100, 6)) # n - nrow(dat) V - 10 # number of folds samps - sample(rep(1:V, length=n), n, replace=FALSE) # # Using the first fold: train - dat[samps!=1,] # fit the model test - dat[samps==1,] # predict Or see ?errorest in the ipred package. Uwe Ligges I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: kolluru ramesh [EMAIL PROTECTED] To: Rpackage help r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 11:19 AM Subject: [R] cross validation How to select training data set and test data set from the original data for performing cross-validation - [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] axis placement with stacked barplots and the asp=1 parameter
Kavithan Siva wrote: Hi, I'm currently using barplot to generate vertically stacked bar charts. I'd like to be able to use the asp=1 parameter with barplot(), but doing this causes the y axis to be placed on the far left as shown in the attachment demo.pdf. See the posting guide, some file types (including pdf) will be omitted from your messages to R-help. You might want to specify a short but easily reproducible examples in 2-5 lines of code. Why do you want to use asp with a barplot??? Uwe Ligges I could get around this by using the negative values for the line parameter of the axis() function. I'd rather not do this and imagine I'm doing something wrong. Any help would be much appreciated. Thanks Kav --- This e-mail may contain confidential and/or privileged inf...{{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
Re: [R] Selecting a subplot of pairs
Yves Brostaux wrote: Hello, I'm trying to plot a set of 3 dependant variables (y) against 4 predictors (x) in a matrix-like plot, sharing x- an y-axis for all the plot on the same column/line : y1/x1 y1/x2 y1/x3 y1/x4 y2/x1 y2/x2 y2/x3 y2/x4 y3/x1 y3/x2 y3/x3 y3/x4 In fact, this plot is a rectangular selection of the result of pairs(), limited to the relations between x's and y's and excluding those within x's and y's. I managed to recreate such a plot using a script with layout(), axis() and so on, but I was wondering if there already exists a clean function for such a task, in case I would encounter this problem again ? The functionality in packages grid and lattice is your friend (if you dislike it, you can twiddle with par()'s argument mfrow). 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
Re: [R] dim vs length for vectors
Arne Henningsen wrote: On Friday 21 January 2005 06:35, Gabor Grothendieck wrote: In R, vectors are not arrays: R v - 1:4 R dim(v) NULL R is.array(v) [1] FALSE R a - array(1:4) R dim(a) [1] 4 R is.array(a) [1] TRUE Is this a feature which is useful in some applications? IMHO the difference between vectors and 1-dimensional arrays is really annoying and I had already several bugs in my code, because I mixed these up. Is it possible in future versions of R that R does not differentiate between vectors and 1-dimensional arrays (e.g. by treating all vectors as 1-dimensional arrays)? No, that would break huge amounts of code! See ?[ and learn how to use its argument drop. Uwe Ligges Arne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] transfer function estimation
Dear all, I am trying to write an R function that can estimate Transfer functions *with additive noise* i.e. Y_t = \delta^-1(B)\omega(B)X_{t-b} + N_t where B is the backward shift operator, b is the delay and N_t is a noisy component that can be modelled as an ARMA process. The parameters to both the impulse response function and the ARMA noisy component need to be estimated simultaneously. I have got as far as being able to compute the residual noise, a_t. However, I am slightly confused about what to do next. Reading Box-Jenkins, 1976 (pp. 391) they state the following However, it seems simplest to work with a standard nonlinear least squares computer program in which the derivatives are determined numerically and an option is available of 'constrained iteration' to prevent instability. It is then only necessary to program the computation of a_t itself... I know that there is a 'nls' function in R but I really do not have a clue about how to use it in this situation. Perhaps Box-Jenkins are confusing me with their last sentance with regard to the a_t's - is this really possible? If anyone could help me on this I would be most grateful. I know this is not exactly an R question, but to the best of my knowledge there is no transfer function estimation method in R at the moment and so this might be a nice additional feature? Kind regards, Sam. [[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
RE: [R] glm and percentage data with many zero values
A hint. You might try with ZIP i.e. zero inflated poisson model. I did not used it, but I have such data to work on. So if there is anyone hwo can point how to do this in R - please. There is also a classs of ZINB or something like that for zero inflated negative binomial models. Actually I just went on web and found a book from Simonoff Analyzing Categorical Data and there are some examples in it for ZIP et al. Look examples for sections 4.5 and 5.4 http://www.stern.nyu.edu/~jsimonof/AnalCatData/Splus/analcatdata.s http://www.stern.nyu.edu/~jsimonof/AnalCatData/Splus/functions.s -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical Faculty URI: http://www.bfro.uni-lj.si Zootechnical Departmentmail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzalefax: +386 (0)1 72 17 888 Slovenia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] chi-Squared distribution
if you check ?qchisq, you'll see that the second argument of the function denotes the non-centrality parameter! Try qchisq(0.75, 1:3) to get your answer. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Prasanna Balaprakash [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 12:27 PM Subject: [R] chi-Squared distribution Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna Prasanna Balaprakash, Université Libre de Bruxelles, 50, Av. F. Roosevelt, CP 194/6, B-1050 Brussels, Belgium. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] chi-Squared distribution
- Original Message - From: Dimitris Rizopoulos [EMAIL PROTECTED] To: Prasanna Balaprakash [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 1:05 PM Subject: Re: [R] chi-Squared distribution if you check ?qchisq, you'll see that the second My mistake, the third argument argument of the function denotes the non-centrality parameter! Try qchisq(0.75, 1:3) to get your answer. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Prasanna Balaprakash [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 12:27 PM Subject: [R] chi-Squared distribution Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna Prasanna Balaprakash, Université Libre de Bruxelles, 50, Av. F. Roosevelt, CP 194/6, B-1050 Brussels, Belgium. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Fwd: RE: [R] cross validation
Note: forwarded message attached. - ---BeginMessage--- Authentication-Results: mta283.mail.scd.yahoo.com from=merck.com; domainkeys=neutral (no sig) X-Originating-IP: [155.91.6.40] Return-Path: [EMAIL PROTECTED] Received: from 155.91.6.40 (EHLO usryim07.merck.com) (155.91.6.40) by mta283.mail.scd.yahoo.com with SMTP; Fri, 21 Jan 2005 03:29:25 -0800 Received: from 155.91.2.6 by usryim07.merck.com with ESMTP (SMTP Relay); Fri, 21 Jan 2005 06:29:17 -0500 X-Server-Uuid: D9643136-67E2-4E6E-A13C-387E6A236A69 Received: from 54.3.102.166 by usrytw32.merck.com with ESMTP (Tumbleweed MMS SMTP Relay (MMS v5.6.1)); Fri, 21 Jan 2005 06:29:10 -0500 X-Server-Uuid: 79464537-DA04-46B1-B103-B8820195B307 Received: by usrygw30.merck.com with Internet Mail Service (5.5.2657.72) id DKTGTC4H; Fri, 21 Jan 2005 06:29:10 -0500 From: Liaw, Andy [EMAIL PROTECTED] Rpackage help r-help@stat.math.ethz.ch Subject: RE: [R] cross validation Date: Fri, 21 Jan 2005 06:29:03 -0500 Return-Receipt-To: Liaw, Andy [EMAIL PROTECTED] MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) X-WSS-ID: 6DEE380C1H05785560-01-01 X-WSS-ID: 6DEE380719C62869-01-01 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-Length: 884 One way is to create an indicator vector that indicate which `fold' a case should belong to. Something like: fold - 10 idx - sample(fold, n, replace=TRUE) for (I in 1:fold) { train.dat - dat[idx != i,] test.dat - dat[idx == i,] ... } Also see the errorest() function in the ipred package. It is more careful in making sure the folds are as close in size as possible, and can do stratified splits. Andy From: kolluru ramesh How to select training data set and test data set from the original data for performing cross-validation - [[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 -- -- ---End Message--- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] mixed effects model:how to include initial conditions
Christoph Scherber wrote: Dear R users, I am analyzing a dataset on growth of plants in response to several factors. I am using a mixed-effects model of the following structure: model-lme(growth~block*treatment*factor1*factor2, random=~1|plot/treatment/initialsize) I have measured the initial size of the plants (in 2003) and thought it might be sensible to include this (random) variation into the random effects term of the model. Is that correct? Or should initialsize rather be included as a covariate into the fixed effects term, as in: alternative-lme(growth~block*initialsize*treatment*factor1*factor2, random=~1|plot/treatment) I would very much appreciate any suggestions on how to analyze these data correctly. Best regards Chris. I think you should include it as a covariate but not in the way you have written it. I would include it as a separate term, not in an interaction alternative-lme(growth~initialsize+block*treatment*factor1*factor2, random=~1|plot/treatment) I recommend that you look carefully at the number of coefficients that you need to estimate in the model as you have specified it and perhaps change to an initial model that had more additive effects and fewer interactions. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Avoiding a Loop?
Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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
RE: [R] memory and swap space in ncdf
Hi Manuel, Look at your memory.limit() and run R with '--mem-max=' option Try also to use the simpler netCDF library Antonio -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] nombre de Manuel Gutierrez Enviado el: viernes, 21 de enero de 2005 10:03 Para: r-help@stat.math.ethz.ch Asunto: [R] memory and swap space in ncdf I've a linux system with 2Gb of memory which is not enough for reading a 446Mb netcdf file using ncdf: library(ncdf) ncold - open.ncdf(gridone.grd) Error: cannot allocate vector of size 1822753 Kb When I look at the free memory in my system I can see that none of the Swap space is being used by R. I am a newbie in linux and R, I've read the Memory help pages but still have some questions: can I use the swap space in R to solve my problem of lack of memory? if not, are there any ways to read the data apart from buying more RAM? Thanks, M __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- No virus found in this incoming message. Checked by AVG Anti-Virus. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating a custom connection to read from multiple files
Hello Andy, thanks for your examples, I rewrote everything to matrices lapply/sapply, rbind calls instead of for-cycles appends, it really helped. Reading files one by one and concatenating is now even faster than concatenating on disk, that 8MB table is read in 3.5 seconds. Tomas rbind is vectorized so you are using it (way) suboptimally. Here's an example: ## Create a 500 x 100 data matrix. x - matrix(rnorm(5e4), 500, 100) ## Generate 50 filenames. fname - paste(f, formatC(1:50, width=2, flag=0), .txt, sep=) ## Write the data to files 50 times. for (f in fname) write(t(x), file=f, ncol=ncol(x)) ## Read the files into a list of data frames. system.time(datList - lapply(fname, read.table, header=FALSE), gcFirst=TRUE) [1] 11.91 0.05 12.33NANA ## Specify colClasses to speed up. system.time(datList - lapply(fname, read.table, colClasses=rep(numeric, 100)), + gcFirst=TRUE) [1] 10.69 0.07 10.79NANA ## Stack them together. system.time(dat - do.call(rbind, datList), gcFirst=TRUE) [1] 5.34 0.09 5.45 NA NA ## Use matrices instead of data frames. system.time(datList - lapply(fname, + function(f) matrix(scan(f), ncol=100, byrow=TRUE)), gcFirst=TRUE) Read 5 items ... Read 5 items [1] 9.49 0.08 15.06NANA system.time(dat - do.call(rbind, datList), gcFirst=TRUE) [1] 0.09 0.03 0.12 NA NA ## Clean up the files. unlink(fname) A couple of points: - Usually specifying colClasses will make read.table() quite a bit faster, even though it's only marginally faster here. Look back in the list archive to see examples. - If your data files are all numerics (as in this example), storing them in matrices will be much more efficient. Note the difference in rbind()ing the 50 data frames and 50 matrices (5.34 seconds vs. 0.09!). rbind.data.frame() needs to ensure that the resulting data frame has unique rownames (a requirement for a legit data frame), and that's probably taking a big chunk of the time. Andy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] chi-Squared distribution in Friedman test
Dear R helpers: Thanks for the previous reply. I am using Friedman racing test. According the the book Pratical Nonprametric Statistic by WJ Conover, after computing the statistics, he suggested to use chi-squared or F distribution to accept or reject null hypothesis. After looking into the source code, I found that R uses chi-sqaured distribution as below: PVAL - pchisq(STATISTIC, PARAMETER, lower = FALSE) but still I cant figure out why they are using this pschisq insted of dchisq. Sorry I am wrong!! Thanking you truly Prasanna - Original Message - From: Dimitris Rizopoulos [EMAIL PROTECTED] To: Prasanna Balaprakash [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 1:05 PM Subject: Re: [R] chi-Squared distribution if you check ?qchisq, you'll see that the second My mistake, the third argument argument of the function denotes the non-centrality parameter! Try qchisq(0.75, 1:3) to get your answer. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Prasanna Balaprakash [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 12:27 PM Subject: [R] chi-Squared distribution Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna Prasanna Balaprakash, Université Libre de Bruxelles, 50, Av. F. Roosevelt, CP 194/6, B-1050 Brussels, Belgium. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] glm and percentage data with many zero values
The ZIP model can be fitted with Jim Lindsey's function fmr from his gnlm library, see: http://popgen0146uns50.unimaas.nl/~jlindsey/rcode.html Bendix Carstensen -- Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2 DK-2820 Gentofte Denmark tel: +45 44 43 87 38 mob: +45 30 75 87 38 fax: +45 44 43 07 06 [EMAIL PROTECTED] www.biostat.ku.dk/~bxc -- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gregor GORJANC Sent: Friday, January 21, 2005 1:05 PM To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Subject: RE: [R] glm and percentage data with many zero values A hint. You might try with ZIP i.e. zero inflated poisson model. I did not used it, but I have such data to work on. So if there is anyone hwo can point how to do this in R - please. There is also a classs of ZINB or something like that for zero inflated negative binomial models. Actually I just went on web and found a book from Simonoff Analyzing Categorical Data and there are some examples in it for ZIP et al. Look examples for sections 4.5 and 5.4 http://www.stern.nyu.edu/~jsimonof/AnalCatData/Splus/analcatdata.s http://www.stern.nyu.edu/~jsimonof/AnalCatData/Splus/functions.s -- Lep pozdrav / With regards, Gregor GORJANC --- University of Ljubljana Biotechnical Faculty URI: http://www.bfro.uni-lj.si Zootechnical Departmentmail: gregor.gorjanc at bfro.uni-lj.si Groblje 3 tel: +386 (0)1 72 17 861 SI-1230 Domzalefax: +386 (0)1 72 17 888 Slovenia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R: chi-Squared distribution in Friedman test
Hi, pchisq - distribution function dchisq - density function pval is the area under the curve, to calculte it you use distribution function which is the integral of density function. See: http://www.itl.nist.gov/div898/handbook/eda/section3/eda362.htm http://mathworld.wolfram.com/DistributionFunction.html f(x) density function F(x) distribution function =Pr(Xx)= integral(f(x)) Hoping I helped you! Regards Vito you wrote: Dear R helpers: Thanks for the previous reply. I am using Friedman racing test. According the the book Pratical Nonprametric Statistic by WJ Conover, after computing the statistics, he suggested to use chi-squared or F distribution to accept or reject null hypothesis. After looking into the source code, I found that R uses chi-sqaured distribution as below: PVAL - pchisq(STATISTIC, PARAMETER, lower = FALSE) but still I cant figure out why they are using this pschisq insted of dchisq. Sorry I am wrong!! Thanking you truly Prasanna = Diventare costruttori di soluzioni Became solutions' constructors The business of the statistician is to catalyze the scientific learning process. George E. P. Box Top 10 reasons to become a Statistician 1. Deviation is considered normal 2. We feel complete and sufficient 3. We are 'mean' lovers 4. Statisticians do it discretely and continuously 5. We are right 95% of the time 6. We can legally comment on someone's posterior distribution 7. We may not be normal, but we are transformable 8. We never have to say we are certain 9. We are honestly significantly different 10. No one wants our jobs Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/palese/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] an R script editor for Mac
JGR has an fairly intelligent editor, and it works on Mac. Andy From: Sean Davis Consider using ESS and xemacs or emacs. You get syntax highlighting, auto-indent, command auto-complete, transcripts for your session, integrated help, and the tools of one of the most powerful text editors on the planet. The learning curve is a bit steep, but if you use R much, it is worth it. Sean On Jan 21, 2005, at 5:35 AM, Jacques VESLOT wrote: Dear all, Could someone please make me know if there is a nice script editor available under Mac, similar to Crimson, that offers R syntax highlighting (and pairs of parentheses underlining) ? Thanks in advance, Jacques VESLOT Cirad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Avoiding a Loop?
If `v' the the vector in the first column and `k' is the constant, then the matrix has k^(j-1) * v in the jth column, right? k - 27.5^seq(0, length=4) k [1] 1.0027.50 756.25 20796.88 outer(1:5, k, *) [,1] [,2][,3] [,4] [1,]1 27.5 756.25 20796.88 [2,]2 55.0 1512.50 41593.75 [3,]3 82.5 2268.75 62390.63 [4,]4 110.0 3025.00 83187.50 [5,]5 137.5 3781.25 103984.38 Andy From: Rau, Roland Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] axis placement with stacked barplots and the asp=1 parameter
On Fri, 2005-01-21 at 12:09 +, Kavithan Siva wrote: Hi Here's some example code which illustrates the issue: dataSeries-array(0, c(5, 2)) dataSeries[1, 1] - 5 dataSeries[2, 1] - 5 dataSeries[3, 1] - 0 dataSeries[4, 1] - 2 dataSeries[5, 1] - 0 dataSeries[1, 2] - 7 dataSeries[2, 2] - 0 dataSeries[3, 2] - 0 dataSeries[4, 2] - 0 dataSeries[5, 2] - 1 barplot(dataSeries, asp=1) Removing the asp=1 parameter produces a correct looking plot. I need to use the asp=1 parameter because I was re-writing the barplot function to create stacked charts with rounded corners (instead of rectangles). For the arc at the corners of the bars to look correct I need asp=1. I've attached a .ps file to show you what I was trying to achieve. Thanks Kav There are a couple of options to consider here. First, note that using the 'asp' argument forces the x and y axes to be scaled such that one unit of measurement in each direction is the same. As you are seeing, this impacts the look of curves and of course would be relevant to certain plots where the horizontal and vertical measures need to be square. One option is to leave the plot as is, but move the y axis closer to the bars. Using your same data above: # Draw the plot, but no axes barplot(dataSeries, asp=1, axes= FALSE) # Now using the 'line' argument, move the axis closer # to the bars. Negative values move the axis to the right. axis(2, line = -14) Another option, which results in something closer to the barplot when not using the 'asp' argument, is to adjust the 'width' argument to increase the horizontal size of the bars: # Draw the barplot and increase the width of the bars # Do not draw the axes barplot(dataSeries, asp=1, width = 8, axes = FALSE) # Now draw the y axis axis(2, at = seq(0, 12, 2)) Note however, that in this example, the vertical dimension is shortened, since the 'asp' argument is still trying to properly set the aspect ratio and the larger bar width increases the range of the x axis. Finally(?), another option to consider is to set par(pty = s) as an alternative to using 'asp = 1'. This results in a square plot region, rather than a maximal (typically rectangular) one. See ?par for more info here. In this case: par(pty = s) barplot(dataSeries) This might result in better looking arcs for your corners. Without having your modified barplot() function, it is hard to know which might work best here, but hopefully this might provide some possibilities. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Straight-line fitting with errors in both coordinates
You want to look in the archives or elsewhere online for errors in variables or total least squares. There are many resources. Note that the method in NR assumes both variables have equal-sized observational errors. If that is not the case for your data, then the method is inappropriate. HTH, David Reiner -Original Message- From: Pan, Chongle [mailto:[EMAIL PROTECTED] Sent: Thursday, January 20, 2005 2:47 PM To: r-help@stat.math.ethz.ch Subject: [R] Straight-line fitting with errors in both coordinates Hi All, I want to fit a straight line into a group of two-dimensional data points with errors in both x and y coordinates. I found there is an algorithm provided in NUMERICAL RECIPES IN C http://www.library.cornell.edu/nr/bookcpdf/c15-3.pdf I'm wondering if there is a similar function for this implemented in R. And how can I change the objective function, from example, from sum of squared error to sum of absolute error? Regards, Chongle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Parallel computations using snow: how to combine boot objects?
Take a look at the utility function in snow called something like clusterSplit. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] mixed effects model:how to include initial conditions
Christoph, If you take a look at journal articles related to this topic published elsewhere, you will find that the most common analysis is: model-lme(growth~initialsize+block+treatment+) maybe it would be important to check if your model really needs the interactions you pointed out. I would suggest to try simpler models firstwhich generally work OK in analysis of growth of plants, trees, etc CM -- Mensaje Original -- Date: Fri, 21 Jan 2005 12:30:07 +0100 From: Christoph Scherber [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] mixed effects model:how to include initial conditions Dear R users, I am analyzing a dataset on growth of plants in response to several factors. I am using a mixed-effects model of the following structure: model-lme(growth~block*treatment*factor1*factor2, random=~1|plot/treatment/initialsize) I have measured the initial size of the plants (in 2003) and thought it might be sensible to include this (random) variation into the random effects term of the model. Is that correct? Or should initialsize rather be included as a covariate into the fixed effects term, as in: alternative-lme(growth~block*initialsize*treatment*factor1*factor2, random=~1|plot/treatment) I would very much appreciate any suggestions on how to analyze these data correctly. Best regards Chris. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] axis placement with stacked barplots and the asp=1 parameter
Kavithan Siva wrote: Hi Here's some example code which illustrates the issue: dataSeries-array(0, c(5, 2)) dataSeries[1, 1] - 5 dataSeries[2, 1] - 5 dataSeries[3, 1] - 0 dataSeries[4, 1] - 2 dataSeries[5, 1] - 0 dataSeries[1, 2] - 7 dataSeries[2, 2] - 0 dataSeries[3, 2] - 0 dataSeries[4, 2] - 0 dataSeries[5, 2] - 1 barplot(dataSeries, asp=1) Removing the asp=1 parameter produces a correct looking plot. I need to use the asp=1 parameter because I was re-writing the barplot function to create stacked charts with rounded corners (instead of rectangles). For the arc at the corners of the bars to look correct I need asp=1. I've attached a .ps file to show you what I was trying to achieve. Marc Schwartz already made some good points. I'd like to suggest to build your new function up on grid using viewports in order to finally get a clean implementation. Uwe Ligges Thanks Kav Kavithan Siva Prytania Investment Advisors LLP 105 Ladbroke Grove, London, W11 1PG Tel: +44 20 7616 8475 Fax: +44 20 7616 8472 Prytania Investment Advisors LLP is regulated by the FSA -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Friday, January 21, 2005 11:52 AM To: Kavithan Siva Cc: r-help@stat.math.ethz.ch Subject: Re: [R] axis placement with stacked barplots and the asp=1 parameter Kavithan Siva wrote: Hi, I'm currently using barplot to generate vertically stacked bar charts. I'd like to be able to use the asp=1 parameter with barplot(), but doing this causes the y axis to be placed on the far left as shown in the attachment demo.pdf. See the posting guide, some file types (including pdf) will be omitted from your messages to R-help. You might want to specify a short but easily reproducible examples in 2-5 lines of code. Why do you want to use asp with a barplot??? Uwe Ligges I could get around this by using the negative values for the line parameter of the axis() function. I'd rather not do this and imagine I'm doing something wrong. Any help would be much appreciated. Thanks Kav --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. The Prytania Group has taken every reasonable precaution to ensure that any attachment to this e-mail has been swept for viruses. However, we cannot accept liability for any damage sustained as a result of software viruses and would advise that you carry out your own virus checks before opening any attachment. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html --- This e-mail may contain confidential and/or privileged inf...{{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
Re: [R] Avoiding a Loop?
Does this do what you want? nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(myconstant, nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 t(apply(mymatrix, 1, function(x) cumprod(x))) __ James HoltmanWhat is the problem you are trying to solve? Executive Technical Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] +1 (513) 723-2929 Rau, Roland [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent by: cc: [EMAIL PROTECTED]Subject: [R] Avoiding a Loop? ath.ethz.ch 01/21/2005 07:31 Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dim vs length for vectors
IMHO the difference between vectors and 1-dimensional arrays is really annoying and I had already several bugs in my code, because I mixed these up. Is it possible in future versions of R that R does not differentiate between vectors and 1-dimensional arrays (e.g. by treating all vectors as 1-dimensional arrays)? No, that would break huge amounts of code! See ?[ and learn how to use its argument drop. What I was proposing doesn't require a lot of programming. Just whenever you call dim(), it does length() if the object is a vector and returns it in the format: R a - 1:12 R dim(a) [1] 12 This means that you can provide a unified introduction to data structures that take only one type of atomic value (and generally call these structures arrays). What I call a one dimensional array only has one dim attribute and hence would use a[4] for extraction (for example), which is consistent with the usage for [ (to my understanding). That way, when you introduce [ and arrays at the same time, you can tell beginners: 1) Run dim() 2) If there's one dim, use [ ]; if there are 2 dims, use [ , ]; if there are 3 dims, you use [ , , ]. This is conceptually easy for a beginner and avoids a bit of frustration. If I need to initiate an empty vector for example I use R a - array() It just looks like the difference between a 1-d array (which doesn't exist as far as I can tell) and a vector is semantic, and I think that R would be more logical if they were treated as the same thing. This doesn't mean changing the way the is.array(), is.vector(), -, etc functions work, but just changing dim(). Yours, Olivia Lau __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Selecting a subplot of pairs
On Friday 21 January 2005 03:13, Yves Brostaux wrote: Hello, I'm trying to plot a set of 3 dependant variables (y) against 4 predictors (x) in a matrix-like plot, sharing x- an y-axis for all the plot on the same column/line : y1/x1 y1/x2 y1/x3 y1/x4 y2/x1 y2/x2 y2/x3 y2/x4 y3/x1 y3/x2 y3/x3 y3/x4 In fact, this plot is a rectangular selection of the result of pairs(), limited to the relations between x's and y's and excluding those within x's and y's. I managed to recreate such a plot using a script with layout(), axis() and so on, but I was wondering if there already exists a clean function for such a task, in case I would encounter this problem again ? You could use xyplot from lattice as: xyplot(y1 + y2 + y3 ~ x1 + x2 + x3 + x4, data=, outer=TRUE) You can add relation=free to get column and row-specific axis limits, but they will be shown for every panel. Hope that helps, 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
RE: [R] Avoiding a Loop?
Dear R-List, thank you very much for the fast answers. Andy Liaw and James Holtman both gave me some example code which does exactly what I want. I will now try to check which one is better suited for my actual matrix (in terms of speed). Thanks, Roland -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, January 21, 2005 3:57 PM To: Rau, Roland Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED] Subject: Re: [R] Avoiding a Loop? Does this do what you want? nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(myconstant, nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 t(apply(mymatrix, 1, function(x) cumprod(x))) __ James HoltmanWhat is the problem you are trying to solve? Executive Technical Consultant -- Office of Technology, Convergys [EMAIL PROTECTED] +1 (513) 723-2929 Rau, Roland [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent by: cc: [EMAIL PROTECTED]Subject: [R] Avoiding a Loop? ath.ethz.ch 01/21/2005 07:31 Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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 + This mail has been sent through the MPI for Demographic Rese...{{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
[R] output data in a fixed format
Dear List, I would like to write my output data to a file with the fixed format like what you can do in SAS. For example: put @1( variable1 ) (10.5) @11 ( variable 2) ($5.) : : etc. Is there a way in R that would allow me to do the same thing? Thank you for your answer in advance. David This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. [[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
Re: [R] dim vs length for vectors
Olivia Lau wrote: IMHO the difference between vectors and 1-dimensional arrays is really annoying and I had already several bugs in my code, because I mixed these up. Is it possible in future versions of R that R does not differentiate between vectors and 1-dimensional arrays (e.g. by treating all vectors as 1-dimensional arrays)? No, that would break huge amounts of code! See ?[ and learn how to use its argument drop. What I was proposing doesn't require a lot of programming. Just whenever you call dim(), it does length() if the object is a vector and returns it in the format: R a - 1:12 R dim(a) [1] 12 Dim reports the dimesnion attribute, so why do you want to make it inconsistant This means that you can provide a unified introduction to data structures that take only one type of atomic value (and generally call these structures arrays). What I call a one dimensional array only has one dim attribute and hence would use a[4] for extraction (for example), which is consistent with the usage for [ (to my understanding). That way, when you introduce [ and arrays at the same time, you can tell beginners: 1) Run dim() 2) If there's one dim, use [ ]; if there are 2 dims, use [ , ]; if there are 3 dims, you use [ , , ]. This is conceptually easy for a beginner and avoids a bit of frustration. Well, you forgot that even a matrix is represented as a vector, but with dimension attributes! And indexing a matrix vector-like has some benefits in some cases. If I need to initiate an empty vector for example I use R a - array() It just looks like the difference between a 1-d array (which doesn't exist as far as I can tell) and a vector is semantic, and I think that R Note the difference: x - 1:5 dim(x) # NULL str(x) # int [1:5] 1 2 3 4 5 x - array(1:5, dim=5) dim(x) # [1] 5 str(x) # int [, 1:5] 1 2 3 4 5 would be more logical if they were treated as the same thing. This doesn't mean changing the way the is.array(), is.vector(), -, etc functions work, but just changing dim(). But then, you won't see the difference beween an 1D array (vector with dim attribute and a vector without dim attribute any more! You might want to read the R Language Definition manual. Uwe Ligges Yours, Olivia Lau __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] chi-Squared distribution in Friedman test
Prasanna Balaprakash wrote: Dear R helpers: Thanks for the previous reply. I am using Friedman racing test. According the the book Pratical Nonprametric Statistic by WJ Conover, after computing the statistics, he suggested to use chi-squared or F distribution to accept or reject null hypothesis. After looking into the source code, I found that R uses chi-sqaured distribution as below: PVAL - pchisq(STATISTIC, PARAMETER, lower = FALSE) but still I cant figure out why they are using this pschisq insted of dchisq. Sorry I am wrong!! You want to get the distribution function rather than the density. Uwe Ligges Thanking you truly Prasanna - Original Message - From: Dimitris Rizopoulos [EMAIL PROTECTED] To: Prasanna Balaprakash [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 1:05 PM Subject: Re: [R] chi-Squared distribution if you check ?qchisq, you'll see that the second My mistake, the third argument argument of the function denotes the non-centrality parameter! Try qchisq(0.75, 1:3) to get your answer. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Prasanna Balaprakash [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 12:27 PM Subject: [R] chi-Squared distribution Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna Prasanna Balaprakash, Université Libre de Bruxelles, 50, Av. F. Roosevelt, CP 194/6, B-1050 Brussels, Belgium. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Avoiding a Loop?
Rau, Roland [EMAIL PROTECTED] writes: Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? How about: myconstant - 27.5 a - 1:5 myconstant - myconstant^((1:nr.of.columns)-1) myconstant [1] 1.0027.50 756.25 20796.88 mymatrix - outer(a,myconstant) mymatrix [,1] [,2][,3] [,4] [1,]1 27.5 756.25 20796.88 [2,]2 55.0 1512.50 41593.75 [3,]3 82.5 2268.75 62390.62 [4,]4 110.0 3025.00 83187.50 [5,]5 137.5 3781.25 103984.38 HTH Zoltan Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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 -- Z. Barta Dept. of Evol. Zool., Univ. of Debrecen, Debrecen, H-4010, Hungary Phone: 36 52 316 666 ext. 2334, Fax: 36 52 533 677 E-mail: [EMAIL PROTECTED], http://puma.unideb.hu/~zbarta/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Avoiding a Loop?
Rau, Roland wrote: Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } nr.of.columns - 4 myconstant - 27.5 mycolumn - 1:5 outer(mycolumn, myconstant^(0:(nr.of.columns-1))) Uwe Ligges Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] chi-Squared distribution in Friedman test
Easy: First letter d = density, p = probability = cumulative distribution function (cdf), q = quantile = inverse cdf, r = pseudo-random number generation. This is in, for example, An Introduction to R. Are you familiar with help.start()? From an R command prompt (at least with recent versions under Windows), this opens a web browser with a page offering manuals, reference, and Miscellaneous Material. An Intro to R is in the upper left. Probability Distributions is section 8. hope this helps. spencer graves Prasanna Balaprakash wrote: Dear R helpers: Thanks for the previous reply. I am using Friedman racing test. According the the book Pratical Nonprametric Statistic by WJ Conover, after computing the statistics, he suggested to use chi-squared or F distribution to accept or reject null hypothesis. After looking into the source code, I found that R uses chi-sqaured distribution as below: PVAL - pchisq(STATISTIC, PARAMETER, lower = FALSE) but still I cant figure out why they are using this pschisq insted of dchisq. Sorry I am wrong!! Thanking you truly Prasanna - Original Message - From: Dimitris Rizopoulos [EMAIL PROTECTED] To: Prasanna Balaprakash [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 1:05 PM Subject: Re: [R] chi-Squared distribution if you check ?qchisq, you'll see that the second My mistake, the third argument argument of the function denotes the non-centrality parameter! Try qchisq(0.75, 1:3) to get your answer. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Prasanna Balaprakash [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Friday, January 21, 2005 12:27 PM Subject: [R] chi-Squared distribution Dear Rs: outer(1:3, 1:3, function(df1, df2) qf(0.95, df1, df2)) I compare this F distribution results with the table, the answers were perfect. But I need to see for chi-sqaured distribution. When I employed the similar formula outer(1:3, 1:3, function(df1, df2) qchisq(0.95, df1, df2)) , I am getting unexpected results. I need to see the following values: p=0.750 . 1 1.323 2 2.773 3 4.108 Thanking you Prasanna Prasanna Balaprakash, Université Libre de Bruxelles, 50, Av. F. Roosevelt, CP 194/6, B-1050 Brussels, Belgium. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] gamm with correlation structure question
Dear group, I am trying to use gamm() in mgcv. Here's the scenario. The data frame has approx. 110K observations with information on paediatric readmission binary outcome (Y/N) and total volume of their most responsible physician as the covariate. Since any physician can have multiple patients, the data contains clustering structure which I am trying to account for. My original formula is a - gamm(readmission~s(volume,fx=F), correlation=corCompSymm(0.1,form=~1|physician), family=binomial) During the first iteration, I received the warning Incompatible formulas for groups in random and correlation. Frankly I don't understand what it means. So I looked up the archive and saw one posted by Prof. Thomas Lumley on lme as follows: http://tolstoy.newcastle.edu.au/R/help/00a/0913.html So I changed my formula as this: a - gamm(readmission~s(volume,fx=F), random=list(physician=~1),family=binomial) However I still get an error message saying Lapack routine dgesv : system is exactly singular. Can anyone suggest a better way to deal with my problem. Please let me know if you need further details. Thank you so much. Regards, Kel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Windows plots fontsize
I recently wrote a package that runs on both Linux and Windows. The functions fetch data to an SQL database and make diverse plots, usually with many labels and annotations. I recently noticed that on SOME windows computers the fonts in the plots were too large, which caused labels to overlap. On other windows computers this does not happen. However on both computers the command par(ps) gives 12 Now, windows is not my forte, but it seems likely that this has to do with some user/system settings. If so, my users would probably object to me tweaking their windows setup since it might have an effect on other programs. One simple solution is to use par(ps=10), but I cannot find out how to set this globally. a) Does anyone know how I can set par(ps=10) by default on all figure? b) Is there a windows specific way to set default fontsizes in figures? Thanks, Halldór -- -- Halldor Bjornsson ([EMAIL PROTECTED]) Vedurstofa Islands (Icelandic Met. Office) Bustadavegur 9, IS-150, Reykjavik, Iceland __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R Reference Card (especially useful for Newbies)
[This hopefully helpful note is posted about once a month] Newbies (and others!) may find the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf useful. It categorizes and organizes a bunch of R's (S's) basic, most used functions so that they can be easily found. For example, paste() is under the Strings heading and expand.grid() is under Data Creation. For newbies struggling to find the right R function as well as veterans who can't quite remember the function name, it's very handy. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to use do.call(rbind, get(list(mlist)))
I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) and I get Error in get(x, envir, mode, inherits) : invalid first argument I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Thanks in advance for showing me the errors in my attempts. Roger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] text miner:
Hi, Does a text miner exist in R-language similar to Splus miner or SAS text miner? I would appreciate any information. TIA, Aldi -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dim vs length for vectors
Perhaps you could just write dim(array(x)) when you want that effect. That has the advantage of not requiring any change to R and preserving the meaning of dim(x) as retrieving the dim attribute. Date: Fri, 21 Jan 2005 10:00:01 -0500 From: Olivia Lau [EMAIL PROTECTED] To: Uwe Ligges [EMAIL PROTECTED],Arne Henningsen [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] dim vs length for vectors What I was proposing doesn't require a lot of programming. Just whenever you call dim(), it does length() if the object is a vector and returns it in the format: R a - 1:12 R dim(a) [1] 12 This means that you can provide a unified introduction to data structures that take only one type of atomic value (and generally call these structures arrays). What I call a one dimensional array only has one dim attribute and hence would use a[4] for extraction (for example), which is consistent with the usage for [ (to my understanding). That way, when you introduce [ and arrays at the same time, you can tell beginners: 1) Run dim() 2) If there's one dim, use [ ]; if there are 2 dims, use [ , ]; if there are 3 dims, you use [ , , ]. This is conceptually easy for a beginner and avoids a bit of frustration. If I need to initiate an empty vector for example I use R a - array() It just looks like the difference between a 1-d array (which doesn't exist as far as I can tell) and a vector is semantic, and I think that R would be more logical if they were treated as the same thing. This doesn't mean changing the way the is.array(), is.vector(), -, etc functions work, but just changing dim(). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] dim vs length for vectors
I think you can assign a dim attribute to a vector to make a 1-d array. v - 1:10 dim(v) NULL dim(v) - 10 dim(v) [1] 10 Also, u - array(1:10,dim=10) u [1] 1 2 3 4 5 6 7 8 9 10 dim(u) [1] 10 Perhaps the philosophy is that vectors are the basic, underlying type, and arrays (including 1-d arrays) carry additional structure information. So arrays are vectors, if you forget the dim attribute, but vectors are not any particular type of array. Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Olivia Lau Sent: Friday, January 21, 2005 10:00 AM To: Uwe Ligges; Arne Henningsen Cc: r-help@stat.math.ethz.ch Subject: Re: [R] dim vs length for vectors IMHO the difference between vectors and 1-dimensional arrays is really annoying and I had already several bugs in my code, because I mixed these up. Is it possible in future versions of R that R does not differentiate between vectors and 1-dimensional arrays (e.g. by treating all vectors as 1-dimensional arrays)? No, that would break huge amounts of code! See ?[ and learn how to use its argument drop. What I was proposing doesn't require a lot of programming. Just whenever you call dim(), it does length() if the object is a vector and returns it in the format: R a - 1:12 R dim(a) [1] 12 This means that you can provide a unified introduction to data structures that take only one type of atomic value (and generally call these structures arrays). What I call a one dimensional array only has one dim attribute and hence would use a[4] for extraction (for example), which is consistent with the usage for [ (to my understanding). That way, when you introduce [ and arrays at the same time, you can tell beginners: 1) Run dim() 2) If there's one dim, use [ ]; if there are 2 dims, use [ , ]; if there are 3 dims, you use [ , , ]. This is conceptually easy for a beginner and avoids a bit of frustration. If I need to initiate an empty vector for example I use R a - array() It just looks like the difference between a 1-d array (which doesn't exist as far as I can tell) and a vector is semantic, and I think that R would be more logical if they were treated as the same thing. This doesn't mean changing the way the is.array(), is.vector(), -, etc functions work, but just changing dim(). Yours, Olivia Lau __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] transfer function estimation
Kemp S E (Comp) [EMAIL PROTECTED] writes: I have got as far as being able to compute the residual noise, a_t. However, I am slightly confused about what to do next. Reading Box-Jenkins, 1976 (pp. 391) they state the following However, it seems simplest to work with a standard nonlinear least squares computer program in which the derivatives are determined numerically and an option is available of 'constrained iteration' to prevent instability. It is then only necessary to program the computation of a_t itself... I know that there is a 'nls' function in R but I really do not have a clue about how to use it in this situation. Perhaps Box-Jenkins are confusing me with their last sentance with regard to the a_t's - is this really possible? I'm not sure I'd trust any computer recommendation from 1976, no matter how famous the authors are. However, the hint would lead me to consider the optim() function. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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
RE: [R] Avoiding a Loop?
Roland: Andy Liaw and others have already given perfectly good answers to this (but note: Using apply() type functions does **not** avoid loops; apply's **are** loops). However, mostly as an illustration to reinforce Uwe Ligges's comments (in the dim vs length thread) about the usefulness of sometimes treating arrays as vectors, I offer the following: nc-ncol(yourmatrix) matrix(yourmatrix[,1]*rep(k^seq(0,length=nc),e=nrow(yourmatrix)),ncol=nc) Alteratively, one could use matrix multiplication: yourmatrix[,1]%*%matrix(k^seq(0,length=nc),nrow=1) Both of these will be very fast (although unlikely to make a noticeable difference without a lot of rows or columns) and I think use less memory than outer() (again, unlikely to make a noticeable difference). -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rau, Roland Sent: Friday, January 21, 2005 4:32 AM To: r-help@stat.math.ethz.ch Subject: [R] Avoiding a Loop? Dear R-Helpers, I have a matrix where the first column is known. The second column is the result of multiplying this first column with a constant const. The third column is the result of multiplying the second column with const. So far, I did it like this (as a simplified example): nr.of.columns - 4 myconstant - 27.5 mymatrix - matrix(numeric(0), nrow=5, ncol=nr.of.columns) mymatrix[,1] - 1:5 for (i in 2:nr.of.columns) { mymatrix[,i] - myconstant * mymatrix[,i-1] } Can anyone give me some advice whether it is possible to avoid this loop (and if yes: how)? Any suggestions are welcome! Thanks, Roland + This mail has been sent through the MPI for Demographic Rese...{{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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Windows plots fontsize
Halldor Björnsson wrote: I recently wrote a package that runs on both Linux and Windows. The functions fetch data to an SQL database and make diverse plots, usually with many labels and annotations. I recently noticed that on SOME windows computers the fonts in the plots were too large, which caused labels to overlap. On other windows computers this does not happen. However on both computers the command par(ps) gives 12 Now, windows is not my forte, but it seems likely that this has to do with some user/system settings. If so, my users would probably object to me tweaking their windows setup since it might have an effect on other programs. One simple solution is to use par(ps=10), but I cannot find out how to set this globally. All this depends on the device. Which device are we talking about? a) Does anyone know how I can set par(ps=10) by default on all figure? For the postscript device see ?ps.options. b) Is there a windows specific way to set default fontsizes in figures? No. But you might want to read the second paragraph in ?windows if we are talking about this device. Uwe Ligges Thanks, Halldór __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to use do.call(rbind, get(list(mlist)))
Here's one way (should work for data frames, too): mlist - paste(m, 1:5, sep=) for (i in 1:5) assign(mlist[i], matrix(runif(4), 2, 2)) do.call(rbind, mget(mlist, .GlobalEnv)) [,1] [,2] [1,] 0.33846095 0.09494054 [2,] 0.65229451 0.26009002 [3,] 0.53969914 0.66481544 [4,] 0.59316498 0.36125843 [5,] 0.24005411 0.01010594 [6,] 0.06878842 0.93929806 [7,] 0.02618064 0.06243190 [8,] 0.08144251 0.04331587 [9,] 0.95216684 0.61066435 [10,] 0.03712678 0.95809995 get() takes a character vector as the first argument, and you passed it a list with one component (a character vector). Even if you pass mlist to get(), it will only get the first one. Andy From: roger bos I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) and I get Error in get(x, envir, mode, inherits) : invalid first argument I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Thanks in advance for showing me the errors in my attempts. Roger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to use do.call(rbind, get(list(mlist)))
Roger: Please re-read ?get, where it says that the x argument must be a single character string name, not a list.You must first create the list using get and then call do.call on that list: do.call(rbind,lapply(mlist,get)) -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of roger bos Sent: Friday, January 21, 2005 9:07 AM To: r-help@stat.math.ethz.ch Subject: [R] how to use do.call(rbind, get(list(mlist))) I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) and I get Error in get(x, envir, mode, inherits) : invalid first argument I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Thanks in advance for showing me the errors in my attempts. Roger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dim vs length for vectors
Sorry, I meant as.array, not array. Date: Fri, 21 Jan 2005 12:21:39 -0500 (EST) From: Gabor Grothendieck [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] dim vs length for vectors Perhaps you could just write dim(array(x)) when you want that effect. That has the advantage of not requiring any change to R and preserving the meaning of dim(x) as retrieving the dim attribute. Date: Fri, 21 Jan 2005 10:00:01 -0500 From: Olivia Lau [EMAIL PROTECTED] To: Uwe Ligges [EMAIL PROTECTED],Arne Henningsen [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Subject: Re: [R] dim vs length for vectors What I was proposing doesn't require a lot of programming. Just whenever you call dim(), it does length() if the object is a vector and returns it in the format: R a - 1:12 R dim(a) [1] 12 This means that you can provide a unified introduction to data structures that take only one type of atomic value (and generally call these structures arrays). What I call a one dimensional array only has one dim attribute and hence would use a[4] for extraction (for example), which is consistent with the usage for [ (to my understanding). That way, when you introduce [ and arrays at the same time, you can tell beginners: 1) Run dim() 2) If there's one dim, use [ ]; if there are 2 dims, use [ , ]; if there are 3 dims, you use [ , , ]. This is conceptually easy for a beginner and avoids a bit of frustration. If I need to initiate an empty vector for example I use R a - array() It just looks like the difference between a 1-d array (which doesn't exist as far as I can tell) and a vector is semantic, and I think that R would be more logical if they were treated as the same thing. This doesn't mean changing the way the is.array(), is.vector(), -, etc functions work, but just changing dim(). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to use do.call(rbind, get(list(mlist)))
roger bos wrote: I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) do.call(rbind, lapply(mlist, get)) Uwe Ligges and I get Error in get(x, envir, mode, inherits) : invalid first argument I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Thanks in advance for showing me the errors in my attempts. Roger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] output data in a fixed format
Shin, David wrote: Dear List, I would like to write my output data to a file with the fixed format like what you can do in SAS. See ?write.matrix in package MASS. Uwe Ligges For example: put @1( variable1 ) (10.5) @11 ( variable 2) ($5.) : : etc. Is there a way in R that would allow me to do the same thing? Thank you for your answer in advance. David This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to use do.call(rbind, get(list(mlist)))
get() doesn't take a list. You need to wrap it in an lapply so that it grabs the dataframes individually and then wraps it into a list for do.call(). The easy way, however, that doesn't involve do.call or get is to simply construct the proper text rbind query and then run it with eval. eval(parse(text = paste(rbind(, paste(m, 302:500, sep = , collapse = , ), To use the do.call() / get() construct, I think this is what you were thinking of: mlist - paste(m,302:500,sep=) do.call(rbind, lapply(mlist, get)) Best, Robert -Original Message- From: roger bos [mailto:[EMAIL PROTECTED] Sent: Friday, January 21, 2005 12:07 PM To: r-help@stat.math.ethz.ch Subject: [R] how to use do.call(rbind, get(list(mlist))) I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) and I get Error in get(x, envir, mode, inherits) : invalid first argument I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Thanks in advance for showing me the errors in my attempts. Roger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] how to use do.call(rbind, get(list(mlist)))
Roger -- First, if you have the data frames in a list already, you can just use those; no need to bother with the names. If the data frames are all separate, but you have the names, you can first create a list of the data frames themselves: do.call(rbind, lapply(mlist, get)) # assumes they're in the workspace An example: temp1 - matrix(runif(10), 5, 2) temp2 - matrix(-runif(10), 5, 2) (for easy identifiability) temp3 - do.call(rbind, lapply(c(temp1, temp2), get)) temp3 - do.call(rbind, list(temp1, temp2)) (same as above) Hope this helps, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of roger bos Sent: Friday, January 21, 2005 12:07 PM To: r-help@stat.math.ethz.ch Subject: [R] how to use do.call(rbind, get(list(mlist))) I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) and I get Error in get(x, envir, mode, inherits) : invalid first argument I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Thanks in advance for showing me the errors in my attempts. Roger __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] some questions about font
Hi, I have been using R to create some mathematical and statistical graphs for a book manuscript, but I got some problems: 1) Some web positngs said that default typeface for math expressions is italic, but in my system (R 2.01 on WinXP), the default is regular font. How can I change the default to ilatic? 2) When use ComputerModern font, (i.e., family=c(CM_regular_10.afm,CM_boldx_10.afm,cmti10.afm,cmbxti10.afm,CM_symbol_10.afm) ), some accented symbols are not available. For example, expression(hat(beta)) will produce warning message like font metrics unknown for character 94. Thanks. Bobai Li -- Assistant Professor Department of Sociology Northwestern University 1810 Chicao Ave., Evanston, IL 60201 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dim vs length for vectors
On Fri, 21 Jan 2005, Olivia Lau wrote: What I was proposing doesn't require a lot of programming. Just whenever you call dim(), it does length() if the object is a vector and returns it in the format: R a - 1:12 R dim(a) [1] 12 One problem is that there is code using is.null(dim(x)) to distinguish vectors from matrices. This code would break. -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
Re: [R] Windows plots fontsize
On Fri, 21 Jan 2005, [ISO-8859-1] Halldor Björnsson wrote: I recently wrote a package that runs on both Linux and Windows. The functions fetch data to an SQL database and make diverse plots, usually with many labels and annotations. I recently noticed that on SOME windows computers the fonts in the plots were too large, which caused labels to overlap. What graphics device are you talking about for your plots? On other windows computers this does not happen. However on both computers the command par(ps) gives 12 As one would expect. But are the windows the same size? Now, windows is not my forte, but it seems likely that this has to do with some user/system settings. If so, my users would probably object to me tweaking their windows setup since it might have an effect on other programs. Windows will be asked for the same fonts, but the window size may differ: see the help page. And users can apply magnification factors. One simple solution is to use par(ps=10), but I cannot find out how to set this globally. a) Does anyone know how I can set par(ps=10) by default on all figure? I think you want to start the device with pointsize=10. ?windows lists the options you have, if it is the device. b) Is there a windows specific way to set default fontsizes in figures? It is device-specific, usually parameter `pointsize'. -- 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
Re: [R] how to use do.call(rbind, get(list(mlist)))
On Fri, 21 Jan 2005, roger bos wrote: I have around 200 data frames I want to rbind in a vectorized way. The object names are: m302 m303 ... m500 So I tried: mlist - paste(m,302:500,sep=) dat - do.call(rbind, get(list(mlist))) and I get Error in get(x, envir, mode, inherits) : invalid first argument Yep. get() takes a single variable name as its argument. If you tried get(list(m302,m303)) you would get the same error. I know rbind is valid because dat - rbind(m302, m303, m304, m305) works, I am just too lazy to type it out to m500. I also tried it without the get() portion, but then dat ends up being a column with just the names of the objects, not the objects themselves. Indeed. This translates to rbind(m302,m303 You could use mget() instead of get(). -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
[R] niceness
Can anyone tell me if the following C code (which proved very useful when using the snow package -- use it to nice slaves) compiles and dyn.loads under Windoze or Mac? It is (apparently) POSIX, so I suppose it is fine in OS X, but does Windoze's advertized POSIX compliance mean anything here? If it doesn't work on some platform, how do I deal with that? I want to submit as contributed package to CRAN. The whole package can be found at http://www.stat.umn.edu/geyer/nice_0.1.tar.gz - begin C code file - #include sys/resource.h #include errno.h #include string.h #include R.h void get_my_priority(int *result) { errno = 0; result[0] = getpriority(PRIO_PROCESS, 0); if (errno != 0) warning(strerror(errno)); } void set_my_priority(int *priority) { if (setpriority(PRIO_PROCESS, 0, priority[0]) != 0) warning(strerror(errno)); } -- end C code file -- -- Charles Geyer Professor, School of Statistics University of Minnesota [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Hardware Suggestions
We are currently running R under Windows 2000 on a server box running with 2 1.2 GHZ Intel Pentium III Processors. We would like to run this on a new computer running Linux and receive a significant speed increase over our current implementation. Could anyone provide some suggestions for a fast 64 BIT Intel based processor computer with a recommendation for memory and speed/type/number of processors. Also which version of R would install out-of-the-box easily on this computer and what version of Linux should be used? Thanks in advance for any help. Jon Dressel, MCSE MCSA MCP A+?xml:namespace prefix = o ns = urn:schemas-microsoft-com:office:office / Applications Supervisor SurroMed, Inc. 1430 O'Brien Drive Menlo Park, CA 94025 Phone: 650.470.2322 Fax: 650.470.2400 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
[R] R Citation
I've cited R in an article accepted by a journal using the following reference: R Development Core Team (2004), R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-00-3, http://www.Rproject.org. I received the following query about my citation. 7. For R Development Core Team [2004], you provided both an ISBN and a Web site address. If this is a book, please provide the name and location of the publisher. If you do not have print publication information, the Web site will be cited in text only, and the reference will be removed from the reference list. I'd appreciate advice on this. I had a similar query about a similar citation of an R package. Thanks, Steve McIntyre [[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
Re: [R] R Citation
On Fri, 21 Jan 2005 16:42:41 -0500 Steve McIntyre wrote: I've cited R in an article accepted by a journal using the following reference: R Development Core Team (2004), R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-00-3, http://www.Rproject.org. ^ The ISBN is 3-900051-07-0 and the URL http://www.R-project.org/. I received the following query about my citation. 7. For R Development Core Team [2004], you provided both an ISBN and a Web site address. If this is a book, please provide the name and location of the publisher. If you do not have print publication information, the Web site will be cited in text only, and the reference will be removed from the reference list. I'd appreciate advice on this. I had a similar query about a similar citation of an R package. Well, both R and the package are software and no books, so print publication information cannot be available. You could either argue that you want to cite software and that the information is complete, or (if the publisher of the journal would not accept that) argue that both are manuals which you want to cite (for which the publisher should have a citation style). One would hope that the latter is not necessary as a publisher should always allow a possibility to properly cite software used in a scientific article... hth, Z Thanks, Steve McIntyre [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] an R script editor for Mac
Hello, Am Freitag, den 21.01.2005, 06:39 -0500 schrieb Sean Davis: Consider using ESS and xemacs or emacs. You get syntax highlighting, auto-indent, command auto-complete, transcripts for your session, integrated help, and the tools of one of the most powerful text editors on the planet. The learning curve is a bit steep, but if you use R much, it is worth it. Yes, definitely. I'd like to add that there is an exellent ref-card regarding the Emacs/ESS duo that may smoothing the learning curve a bit! Don't remember the right place to fetch from but I could give you a copy of mine if desired. Drop me a line. 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
[R] which.pmin?
I have two vectors (k.floor and k.ceiling) of integers of the same length, and a function (fpr). b - 10:40 k.floor - floor(log(2) * b) k.ceiling - ceiling(log(2) * b) fpr.floor - fpr(b, k.floor) fpr.ceiling - fpr(b, k.ceiling) If R had a element-wise ternary function, I'd like to do something like this: (fpr.floor fpr.ceiling) ? k.floor : k.ceiling That is, I'd like to go through the two vectors in parallel, picking the one that returns the lower value of fpr. Failing to find such a function, I wrote the following two lines: ind - sapply(data.frame(rbind(fpr.floor,fpr.ceiling)), which.min) opt.k - cbind(k.floor,k.ceiling)[1:length(ind)+length(ind)*(ind-1)] opt.k is the vector I want, but I guess I abuse some functions here. I'd like to ask the experts, What is the proper R-way to do this? The API should be like which.pmin(FUN, X, Y, ...) that returns a vector of the same length as X (and Y), provided that X, Y, ... have the same length. Please fill the function body. Seung __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] which.pmin?
On Fri, 21 Jan 2005, Seung Jun wrote: If R had a element-wise ternary function, I'd like to do something like this: (fpr.floor fpr.ceiling) ? k.floor : k.ceiling R does: ifelse() -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
Re: [R] which.pmin?
On Fri, 2005-01-21 at 17:26 -0500, Seung Jun wrote: I have two vectors (k.floor and k.ceiling) of integers of the same length, and a function (fpr). b - 10:40 k.floor - floor(log(2) * b) k.ceiling - ceiling(log(2) * b) fpr.floor - fpr(b, k.floor) fpr.ceiling - fpr(b, k.ceiling) If R had a element-wise ternary function, I'd like to do something like this: (fpr.floor fpr.ceiling) ? k.floor : k.ceiling That is, I'd like to go through the two vectors in parallel, picking the one that returns the lower value of fpr. Failing to find such a function, I wrote the following two lines: ind - sapply(data.frame(rbind(fpr.floor,fpr.ceiling)), which.min) opt.k - cbind(k.floor,k.ceiling)[1:length(ind)+length(ind)*(ind-1)] opt.k is the vector I want, but I guess I abuse some functions here. I'd like to ask the experts, What is the proper R-way to do this? The API should be like which.pmin(FUN, X, Y, ...) that returns a vector of the same length as X (and Y), provided that X, Y, ... have the same length. Please fill the function body. I believe that ifelse() is what you seek. Try: ifelse(fpr.floor fpr.ceiling, k.floor, k.ceiling) See ?ifelse for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] which.pmin?
If I understand you correctly you could just do ifelse(fpr.floor fpr.ceiling, k.floor, k.ceiling) cheers, Rolf Turner [EMAIL PROTECTED] ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+=== Seung Jun wrote: I have two vectors (k.floor and k.ceiling) of integers of the same length, and a function (fpr). b - 10:40 k.floor - floor(log(2) * b) k.ceiling - ceiling(log(2) * b) fpr.floor - fpr(b, k.floor) fpr.ceiling - fpr(b, k.ceiling) If R had a element-wise ternary function, I'd like to do something like this: (fpr.floor fpr.ceiling) ? k.floor : k.ceiling That is, I'd like to go through the two vectors in parallel, picking the one that returns the lower value of fpr. Failing to find such a function, I wrote the following two lines: ind - sapply(data.frame(rbind(fpr.floor,fpr.ceiling)), which.min) opt.k - cbind(k.floor,k.ceiling)[1:length(ind)+length(ind)*(ind-1)] opt.k is the vector I want, but I guess I abuse some functions here. I'd like to ask the experts, What is the proper R-way to do this? The API should be like which.pmin(FUN, X, Y, ...) that returns a vector of the same length as X (and Y), provided that X, Y, ... have the same length. Please fill the function body. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Fw: [R] R Citation
Dear Achim, Thanks for the comment. Here is the publisher's style guideline (AGU) Because the Internet is dynamic environment and sites may change or move, treat World Wide Web, ftp files, and electronically archived data stored at data centers other than World or National Data Centers as unpublished, i.e., in text only. http://www.agu.org/pubs/AuthorRefSheet.pdf So by this policy, R and its packages cannot be included in the list of references and has the same citation as a pers.comm. The problem for my paper can be resolved by removing the citation from references to text, but this seems unfair to R and the package authors for AGU publications. AGU does recognize some permanent data archives listed here http://www.agu.org/pubs/datacent.html - maybe it would make sense to have a mirror at one of these permanent archives for packages and versions. Regards, Steve McIntyre - Original Message - From: Achim Zeileis [EMAIL PROTECTED] To: Steve McIntyre [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, January 21, 2005 5:06 PM Subject: Re: [R] R Citation On Fri, 21 Jan 2005 16:42:41 -0500 Steve McIntyre wrote: I've cited R in an article accepted by a journal using the following reference: R Development Core Team (2004), R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-00-3, http://www.Rproject.org. ^ The ISBN is 3-900051-07-0 and the URL http://www.R-project.org/. I received the following query about my citation. 7. For R Development Core Team [2004], you provided both an ISBN and a Web site address. If this is a book, please provide the name and location of the publisher. If you do not have print publication information, the Web site will be cited in text only, and the reference will be removed from the reference list. I'd appreciate advice on this. I had a similar query about a similar citation of an R package. Well, both R and the package are software and no books, so print publication information cannot be available. You could either argue that you want to cite software and that the information is complete, or (if the publisher of the journal would not accept that) argue that both are manuals which you want to cite (for which the publisher should have a citation style). One would hope that the latter is not necessary as a publisher should always allow a possibility to properly cite software used in a scientific article... hth, Z Thanks, Steve McIntyre [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Hardware Suggestions
Jon Dressel [EMAIL PROTECTED] writes: We are currently running R under Windows 2000 on a server box running with 2 1.2 GHZ Intel Pentium III Processors. We would like to run this on a new computer running Linux and receive a significant speed increase over our current implementation. Could anyone provide some suggestions for a fast 64 BIT Intel based processor computer with a recommendation for memory and speed/type/number of processors. Also which version of R would install out-of-the-box easily on this computer and what version of Linux should be used? Thanks in advance for any help. (I assume Intel also means AMD?) People seem quite happy with dual and quad Opterons (and there are dual-core chips coming up soon, I hear), but you do need to do your homework, since there have been trouble with some chipsets/BIOSes in large-memory configurations, and there are not all that many people using the high-end stuff. Check out the archives of the x86_64 mailing lists for the popular Linux distributions. Distribution-wise Fedora Core and SuSE both work nicely and R has been tested on both with no issues that I can think of. There's an RPM up for FC3, but it's not a big hassle to build from source and you need most of the build tools in place to install CRAN packages anyway. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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
Re: Fw: [R] R Citation
On Fri, 21 Jan 2005 17:48:39 -0500 Steve McIntyre wrote: Dear Achim, Thanks for the comment. Here is the publisher's style guideline(AGU) Because the Internet is dynamic environment and sites may change or move, treat World Wide Web, ftp files, and electronically archived data stored at data centers other than World or National Data Centers as unpublished, i.e., in text only. http://www.agu.org/pubs/AuthorRefSheet.pdf My understanding of this is that you cannot refer to files (especially documents and data files) in the references. A software package is neither. So maybe you should just remove the URL? For proprietary software packages, you don't have a URL from which you can download it, but nevertheless you should cite the software you used in an article. In short: The text above does not provide a guideline on how to cite software (afaics), and thus it does not apply to citing R or R packages. my EUR 0.02 Z So by this policy, R and its packages cannot be included in the list of references and has the same citation as a pers.comm. The problem for my paper can be resolved by removing the citation from references to text, but this seems unfair to R and the package authors for AGU publications. AGU does recognize some permanent data archives listed here http://www.agu.org/pubs/datacent.html - maybe it would make sense to have a mirror at one of these permanent archives for packages and versions. Regards, Steve McIntyre - Original Message - From: Achim Zeileis [EMAIL PROTECTED] To: Steve McIntyre [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, January 21, 2005 5:06 PM Subject: Re: [R] R Citation On Fri, 21 Jan 2005 16:42:41 -0500 Steve McIntyre wrote: I've cited R in an article accepted by a journal using the following reference: R Development Core Team (2004), R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-00-3, http://www.Rproject.org. ^ The ISBN is 3-900051-07-0 and the URL http://www.R-project.org/. I received the following query about my citation. 7. For R Development Core Team [2004], you provided both an ISBN and a Web site address. If this is a book, please provide the name and location of the publisher. If you do not have print publication information, the Web site will be cited in text only, and the reference will be removed from the reference list. I'd appreciate advice on this. I had a similar query about a similar citation of an R package. Well, both R and the package are software and no books, so print publication information cannot be available. You could either argue that you want to cite software and that the information is complete, or (if the publisher of the journal would not accept that) argue that both are manuals which you want to cite (for which the publisher should have a citation style). One would hope that the latter is not necessary as a publisher should always allow a possibility to properly cite software used in a scientific article... hth, Z Thanks, Steve McIntyre [[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 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] niceness
On Fri, 21 Jan 2005 13:21:45 -0600, Charles Geyer [EMAIL PROTECTED] wrote : Can anyone tell me if the following C code (which proved very useful when using the snow package -- use it to nice slaves) compiles and dyn.loads under Windoze or Mac? It is (apparently) POSIX, so I suppose it is fine in OS X, but does Windoze's advertized POSIX compliance mean anything here? It doesn't compile with the standard MinGW installation, because the sys/resource.h header file isn't found. 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
[R] Plotting with Statistics::R, Perl/R
I am trying to plot in R from a perl script using the Statistics::R package as my bridge. The following are the conditions: 0. I am running from a Linux server. 1. Even without xwindows the following saves test.png correctly from an interactive session with R: xy-cbind(1,1) png(test.png) plot(xy) dev.off() 2. However, when called from the perl script I get the ff. warning: -- X11 module is not available under this GUI -- and nothing is saved 3. I tried to hijack the script by modifying lib/Statistics/R/Bridge/Linux.pm to remove the gui=none setting -- $this-{START_CMD} = $this-{R_BIN} --slave --vanilla --gui=none ; -- changed to -- $this-{START_CMD} = $this-{R_BIN} --slave --vanilla ; -- 4. When plotting in R from the perl script again, I no longer get the warning and I get test.png saved, but it is empty. Please advise. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plotting with Statistics::R, Perl/R
On Fri, Jan 21, 2005 at 06:06:45PM -0800, Leah Barrera wrote: I am trying to plot in R from a perl script using the Statistics::R package as my bridge. The following are the conditions: 0. I am running from a Linux server. 1. Even without xwindows the following saves test.png correctly from an interactive session with R: xy-cbind(1,1) png(test.png) plot(xy) dev.off() 2. However, when called from the perl script I get the ff. warning: -- X11 module is not available under this GUI -- and nothing is saved 3. I tried to hijack the script by modifying lib/Statistics/R/Bridge/Linux.pm to remove the gui=none setting -- $this-{START_CMD} = $this-{R_BIN} --slave --vanilla --gui=none ; -- changed to -- $this-{START_CMD} = $this-{R_BIN} --slave --vanilla ; -- 4. When plotting in R from the perl script again, I no longer get the warning and I get test.png saved, but it is empty. Please advise. It's a FAQ. Plotting certain formats requires the X11 server to be present as the font metrics for those formats can be supplied only the X11 server. Other drivers don;t the font metrics from X11 -- I think pdf is a good counterexample. When you run in 'batch' via a Perl script, you don't have the X11 server -- even though it may be on the machine and running, it is not associated with the particular session running your Perl job. There are two common fixes: a) if you must have png() as a format, you can start a virtual X11 server with the xvfb server -- this is a bit involved, but doable; b) if you can do other formats instead of png(), this can work -- I have forgotten the details but the story has been discussed many times over here as web servers use the same session-less setup. In essence, using ghostscript for the bitmap conversion works so it may be that the bitmap() device works. If I recall pdf(), works. c) With that, you could try creating a pdf() first, and then use Perl to call ghostscript to convert the pdf for you. R can do that too for you, but only for certain devices. Hth, Dirk -- Better to have an approximate answer to the right question than a precise answer to the wrong question. -- John Tukey as quoted by John Chambers __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Package Status, Shipment Number : 1F33hx0E
ferris-medz.net/?wid=209095 13. Ninety six bottles of beer, three a's, three b's, one c, two d's, thirty two e's, six f's, two g's, six h's, twelve i's, one j, one k, five l's, one m, eighteen n's, fourteen o's, one p, six r's, twenty seven s's, twenty t's, two u's, seven v's, nine w's, five x's, and five y's on the wall. All my life I've wanted to be someone; I guess I should have been more specific.Jane Wagner/Lily Tomlin (1939- ) That pilot is missing surfing. Lots of times you have to pretend to join a parade in which you're not really interested in order to get where you're going.-Christopher Darlington Morley (1890-1957) [[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
Re: [R] Plotting with Statistics::R, Perl/R
Dirk Eddelbuettel wrote: Plotting certain formats requires the X11 server to be present as the font metrics for those formats can be supplied only the X11 server. Other drivers don;t the font metrics from X11 -- I think pdf is a good counterexample. When you run in 'batch' via a Perl script, you don't have the X11 server -- even though it may be on the machine and running, it is not associated with the particular session running your Perl job. There are two common fixes: a) if you must have png() as a format, you can start a virtual X11 server with the xvfb server -- this is a bit involved, but doable; An example of a Python programme which manages the starting of an Xvfb server when one is required can be found in the xvfb_spawn.py file /SOOMv0 directory of the tarball for NetEpi Analysis, which can be downloaded by following the links at http://www.netepi.org xvfb_spawn.py was written for use with RPy, which is a Python-to-R bridge, when used in a Web server setting (hence no X11 display server available). It should be possible to translate the programme to Perl, or to write somethig similar in Perl. Comments in the code note some potential security traps for the unwary. Hopefully one day the dependency of the R raster graphics devices on an X11 server will be removed. R on Win32 doesn't have that dependency (but then, Windows machines, even servers, have displays running all the time as part of their kernel, and who would wish that on other operating system?). However, there are several graphics back-ends which produce very high quality raster graphics on POSIX platforms without the need for an X11 device to be present - Agg (Anti-grain geometry, see http://www.antigrain.com/) and Cairo (see http://cairographics.org/) spring to mind (usually disclaimers about the foregoing comments not meaning to seem like ingratitude to the R development team etc apply). Tim C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: Fw: [R] R Citation
Dear Michael and Achim, the problem is obviously that AGU doesn't have a policy for referencing software. (They have an excellent policy for citing data, but the policy is seldom followed in the paleoclimate field.) I suppose that I could cite a reference manual for R, but that seems a bit weird. Likewise, for the waveslim package, I suppose that I could reference one of Whitcher's publications about it, but that's not really what's involved. AGU makes a distinction between a citation in the body of the article and in the list of references, and does permit citation of software in a non-recognized archive in the body of the article. I'm not in a position to get into a debate with AGU over how they run their citations. It seems to me that the right course of action is to put the R citation (and the package citation) in the body of the text. In a few weeks, I'll probably write to AGU about policies for citing software. I think that their main concern over citing of Internet sources is permanence. So unless R packages are mirrored at a recognized permanent data archive, AGU won't permit the citation in the references (although it will in the running text). Maybe it would be a good idea to have an R mirror at one of the permanent data archives. I'm sure one of them wouldn't mind. Regards, Steve McIntyre [[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
Re: Fw: [R] R Citation
On Friday 21 January 2005 14:48, Steve McIntyre wrote: Dear Achim, Thanks for the comment. Here is the publisher's style guideline (AGU) Because the Internet is dynamic environment and sites may change or move, treat World Wide Web, ftp files, and electronically archived data stored at data centers other than World or National Data Centers as unpublished, i.e., in text only. http://www.agu.org/pubs/AuthorRefSheet.pdf So by this policy, R and its packages cannot be included in the list of references and has the same citation as a pers.comm. The problem for my paper can be resolved by removing the citation from references to text, but this seems unfair to R and the package authors for AGU publications. AGU does recognize some permanent data archives listed here http://www.agu.org/pubs/datacent.html - maybe it would make sense to have a mirror at one of these permanent archives for packages and versions. Regards, Steve McIntyre Steve, Depending upon the actual format of your paper, you might either add a reference to R in your Methods or in an acknowledgements section if the format permits such. Looking at the AGU publishing guide, their obvious concern is to insure that the data used in an article are sourced properly. Statistical software, like ground-penetrating radar or a magnetometer for instance, is a tool. Thus it really falls within the scope of methods. It is reasonable in that case to cite the URL in the text. You can also elaborate somewhat and explain sonething of the history and origins of R, citing the The R Reference Manual by the R Development Core Team, which is available through Amazon Books (volume 1 for mere $57.56 plus shipping at present). You ought to be able with a bit of creativity to drag in mention of both the URL and the manuals. Good luck, John __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plotting with Statistics::R, Perl/R
Dirk Eddelbuettel wrote: On Fri, Jan 21, 2005 at 06:06:45PM -0800, Leah Barrera wrote: I am trying to plot in R from a perl script using the Statistics::R package as my bridge. The following are the conditions: 0. I am running from a Linux server. Plotting certain formats requires the X11 server to be present as the font metrics for those formats can be supplied only the X11 server. Other drivers don;t the font metrics from X11 -- I think pdf is a good counterexample. When you run in 'batch' via a Perl script, you don't have the X11 server -- even though it may be on the machine and running, it is not associated with the particular session running your Perl job. There are two common fixes: a) if you must have png() as a format, you can start a virtual X11 server with the xvfb server -- this is a bit involved, but doable; Attached is an init script I use to start up xvfb on Linux. HTH, Joe #!/bin/bash # # syslogStarts Xvfb. # # # chkconfig: 2345 12 88 # description: Xvfb is a facility that applications requiring an X frame buffer \ # can use in place of actually running X on the server # Source function library. . /etc/init.d/functions [ -f /usr/X11R6/bin/Xvfb ] || exit 0 XVFB=/usr/X11R6/bin/Xvfb :5 -screen 0 1024x768x16 RETVAL=0 umask 077 start() { echo -n $Starting Xvfb: $XVFB RETVAL=$? echo_success echo [ $RETVAL = 0 ] touch /var/lock/subsys/Xvfb return $RETVAL } stop() { echo -n $Shutting down Xvfb: killproc Xvfb RETVAL=$? echo [ $RETVAL = 0 ] rm -f /var/lock/subsys/Xvfb return $RETVAL } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart|reload) restart ;; condrestart) [ -f /var/lock/subsys/Xvfb ] restart || : ;; *) echo $Usage: $0 {start|stop|restart|condrestart} exit 1 esac exit $RETVAL __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plotting with Statistics::R, Perl/R
Joe Conway wrote: Dirk Eddelbuettel wrote: On Fri, Jan 21, 2005 at 06:06:45PM -0800, Leah Barrera wrote: I am trying to plot in R from a perl script using the Statistics::R package as my bridge. The following are the conditions: 0. I am running from a Linux server. Plotting certain formats requires the X11 server to be present as the font metrics for those formats can be supplied only the X11 server. Other drivers don;t the font metrics from X11 -- I think pdf is a good counterexample. When you run in 'batch' via a Perl script, you don't have the X11 server -- even though it may be on the machine and running, it is not associated with the particular session running your Perl job. There are two common fixes: a) if you must have png() as a format, you can start a virtual X11 server with the xvfb server -- this is a bit involved, but doable; Attached is an init script I use to start up xvfb on Linux. HTH, Joe #!/bin/bash # # syslogStarts Xvfb. # # # chkconfig: 2345 12 88 # description: Xvfb is a facility that applications requiring an X frame buffer \ # can use in place of actually running X on the server # Source function library. . /etc/init.d/functions [ -f /usr/X11R6/bin/Xvfb ] || exit 0 XVFB=/usr/X11R6/bin/Xvfb :5 -screen 0 1024x768x16 RETVAL=0 umask 077 start() { echo -n $Starting Xvfb: $XVFB RETVAL=$? echo_success echo [ $RETVAL = 0 ] touch /var/lock/subsys/Xvfb return $RETVAL } stop() { echo -n $Shutting down Xvfb: killproc Xvfb RETVAL=$? echo [ $RETVAL = 0 ] rm -f /var/lock/subsys/Xvfb return $RETVAL } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart|reload) restart ;; condrestart) [ -f /var/lock/subsys/Xvfb ] restart || : ;; *) echo $Usage: $0 {start|stop|restart|condrestart} exit 1 esac exit $RETVAL Hmm, the only problem with that is that, if I am not mistaken, you are starting Xvfb without any authentication, and I am told by people who know about such things that in the context of an Internet-accessible Web server, having an X server accepting unauthenticated connections is not a good idea. In other, less hostile environments, it might be OK. Maybe such concerns are unreasonable paranoia, but my motto is better safe than sorry when it comes to Internet-facing servers. I think there are also other switches you can pass to Xvfb to stop it listening on various TCP/IP ports etc. Tim C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html