[R] GAM Package: preplot.gam taking a **long** time
Hi: I have a large data set that I'm testing and I'm finding that preplot.gam is taking a very long amount of time to compute (like, more than 20 minutes). My machine is 32-bit, Debian unstable, 4GB memory, dual Xeon 3GHz. While the data set is very large, the gam() procedure is able to compute the model without any trouble, in a minute or so. Is there any reason why preplot.gam would be so slow? I am not using newdata in the preplot.gam function, so I am assuming that the memory is not a problem. Or could it be? Is it normal for preplot.gam to take so long on large data sets? I have not had this experience with S-Plus, on a lower quality machine, same data. Thanks, Paul __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] Random Survival Forest 1.0.0 is now available.
Dear useRs, Release 1.0.0 of the new R package 'randomSurvivalForest' is now available on CRAN and its mirrors. The package implements Ishwaran and Kogalur's Random Survival Forests algorithm for right censored survival data. The algorithm is closely patterned after Breiman's random forests, but suitably modified for the survival setting. Some key features are: o An ensemble cumulative hazard is constructed from binary recursive survival trees grown under different splitting rules. o Mortality estimates interpretable in terms of total number of deaths are provided. o An out-of-bag estimate of Harrell's concordance index is provided for assessing prediction. Detailed information on usage can be found in the manual. Thank you. Hemant Ishwaran, Udaya B. Kogalur ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Gower Similarity Coefficient
Timothy Rye wrote: I'm interested in clustering my data using the Gower Similarity Coefficient, and I was wondering if R is capable of using that metric Timothy Rye RSiteSearch(Gower) points to a number of relevant messages in the archives. It also reveals gdist() in the mvpart package, vegdist() in the vegan package, and dist.binary() in the ade4 package, which may do what you want. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] split a y-axis to show data on different scales
Rashmi Mathur wrote: Hello, How do I split a y-axis to plot data on different scales? Eg: x - 1:10 y - c(-0.01,0.79,0.74,0.55,-0.67,0.32,-0.47,-0.05,723,759) plot(x,y) I'd like to show these data on the same plot, but the way it's written, all contrast in the first 8 data points is lost. Can R split a y-axis for me? Hi Rashmi, Although Hadley's answer is relevant (displaying vastly different ranges of data can be dangerous) you might find that gap.plot in the plotrix package will do the dirty deed. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] posting
[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 and provide commented, minimal, self-contained, reproducible code.
[R] naive help with setting node attributes
I have been trying for a LONG time to figure out how to do what I imagine is a fairly simple graph rendering issue. Can anyone help me figure out how to take two LARGE graphs G1 and G2 (not random) and set their node/edge attributes separately and uniquely such that when they are joined, G1 and G2 will retain their unique attributes under rendering? Thanks, AJ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] naive help with setting node attributes
AJ, hmmm, which package are you using? This might help answering the question, which is quite hard to decypher in this form. At least for me. Gabor On Mon, Aug 14, 2006 at 02:25:17AM -0800, adlai burman wrote: I have been trying for a LONG time to figure out how to do what I imagine is a fairly simple graph rendering issue. Can anyone help me figure out how to take two LARGE graphs G1 and G2 (not random) and set their node/edge attributes separately and uniquely such that when they are joined, G1 and G2 will retain their unique attributes under rendering? Thanks, AJ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] column to row
Dear mailing list I have a data in two columns and how can i convert it to one row . thank you in advance inpute 1 2 3 4 5 6 7 8 9 1 out put 1 2 3 4 5 6 7 8 9 1 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] column to row
On 8/14/06, yohannes alazar [EMAIL PROTECTED] wrote: I have a data in two columns and how can i convert it to one row . thank you in advance inpute 1 2 3 4 5 6 7 8 9 1 out put 1 2 3 4 5 6 7 8 9 1 An example follows: input - matrix(1:10,5,2) input [,1] [,2] [1,]16 [2,]27 [3,]38 [4,]49 [5,]5 10 output - c(input[,1],input[,2]) output [1] 1 2 3 4 5 6 7 8 9 10 Paul __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Calculating trace of products
Dear all, I need to calculate tr(A B), tr(A B A B) and similar quantities **fast** where the matrices A, B are symmetrical. I've searched for built-in functions for that purpose, but without luck. Can anyone help? Thanks in advance Søren [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] column to row
probably something like: mat - matrix(c(1:9, 1), 5, byrow = TRUE) c(t(mat)) 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/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: yohannes alazar [EMAIL PROTECTED] To: r-help r-help@stat.math.ethz.ch Sent: Monday, August 14, 2006 1:47 PM Subject: [R] column to row Dear mailing list I have a data in two columns and how can i convert it to one row . thank you in advance inpute 1 2 3 4 5 6 7 8 9 1 out put 1 2 3 4 5 6 7 8 9 1 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] column to row
input - matrix(1:10,5,2) input [,1] [,2] [1,]16 [2,]27 [3,]38 [4,]49 [5,]5 10 as.vector(input) [1] 1 2 3 4 5 6 7 8 9 10 Neuro From: yohannes alazar [EMAIL PROTECTED] To: r-help r-help@stat.math.ethz.ch Subject: [R] column to row Date: Mon, 14 Aug 2006 12:47:25 +0100 Dear mailing list I have a data in two columns and how can i convert it to one row . thank you in advance inpute 1 2 3 4 5 6 7 8 9 1 out put 1 2 3 4 5 6 7 8 9 1 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating trace of products
I would suspect that something simple like sum(diag(crossprod(A,B))) would be quite competitive... url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox: 217-333-4558University of Illinois fax: 217-244-6678Champaign, IL 61820 On Aug 14, 2006, at 6:58 AM, Søren Højsgaard wrote: Dear all, I need to calculate tr(A B), tr(A B A B) and similar quantities **fast** where the matrices A, B are symmetrical. I've searched for built-in functions for that purpose, but without luck. Can anyone help? Thanks in advance Søren [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculating trace of products
check the following: A - matrix(rnorm(100*100), 100, 100); A - A + t(A) B - matrix(rnorm(100*100), 100, 100); B - B + t(B) sum(diag(A %*% B)) sum(A * B) system.time(for(i in 1:1) out - sum(diag(A %*% B))) system.time(for(i in 1:1) out - sum(A * B)) 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/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Søren Højsgaard [EMAIL PROTECTED] To: R-help list r-help@stat.math.ethz.ch Sent: Monday, August 14, 2006 1:58 PM Subject: [R] Calculating trace of products Dear all, I need to calculate tr(A B), tr(A B A B) and similar quantities **fast** where the matrices A, B are symmetrical. I've searched for built-in functions for that purpose, but without luck. Can anyone help? Thanks in advance Søren [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Gower Similarity Coefficient
Chuck == Chuck Cleland [EMAIL PROTECTED] on Mon, 14 Aug 2006 04:53:55 -0400 writes: Chuck Timothy Rye wrote: I'm interested in clustering my data using the Gower Similarity Coefficient, and I was wondering if R is capable of using that metric Timothy Rye Chuck RSiteSearch(Gower) points to a number of relevant Chuck messages in the archives. It also reveals gdist() in Chuck the mvpart package, vegdist() in the vegan package, Chuck and dist.binary() in the ade4 package, which may do Chuck what you want. The daisy() function from the package cluster (which is *recommended* hence part of every complete R installation) is also based on Gower's (dis)similarity coefficient. So you don't need to install a new package [But I need to add the word 'Gower' to a better place on daisy()'s help page ...] Martin Maechler, ETH Zurich. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Gower Similarity Coefficient
Martin == Martin Maechler [EMAIL PROTECTED] on Mon, 14 Aug 2006 14:30:39 +0200 writes: Chuck == Chuck Cleland [EMAIL PROTECTED] on Mon, 14 Aug 2006 04:53:55 -0400 writes: Chuck Timothy Rye wrote: I'm interested in clustering my data using the Gower Similarity Coefficient, and I was wondering if R is capable of using that metric Timothy Rye Chuck RSiteSearch(Gower) points to a number of relevant Chuck messages in the archives. It also reveals gdist() in Chuck the mvpart package, vegdist() in the vegan package, Chuck and dist.binary() in the ade4 package, which may do Chuck what you want. Martin The daisy() function from the package cluster Martin (which is *recommended* hence part of every complete Martin R installation) is also based on Gower's Martin (dis)similarity coefficient. Martin So you don't need to install a new package [But I Martin need to add the word 'Gower' to a better place on Martin daisy()'s help page ...] Hmm, actually, it's already there. And if you use help.search() smartly [I use lib.loc = R system library in order to not search in the more than 1000 CRAN and bioconductor packages we have installed], help.search(Gower, agrep = FALSE, lib.loc = tail(.libPaths(), 1)) I get exactly the correct match Help files with alias or concept or title matching $,1rx(BGower$,1ry(B using regular expression matching: daisy(cluster) Dissimilarity Matrix Calculation Type 'help(FOO, package = PKG)' to inspect entry 'FOO(PKG) TITLE'. Martin Maechler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] mtext uses the typographical descender to align text
Hello One sometimes (quite often really ) marvel at the choice of defaults in R's graphic engine. For some obscure reason, mtext uses the typographical descender (bottom of letters) to align text. That is: gG will end up slightly higher that GG. Depending on the font, Q might end up higher than O. (for explanation of baseline descender see: http://www.paratype.com/help/term/terms.asp?code=88) Example: y1 - rnorm(30) y2 - rnorm(30) group - as.factor(rep(1:6, each=10)) y - c(y1,y2) testdata - data.frame(group, y) plot (y ~group, axes=F, xlab=why does R align the BOTTOM of the letters??? ) box() mtext(expression(italic(Normal 1)) ,1 , line=1, at=1) mtext(expression(italic(Higher 1 )) ,1 , line=1, at=2) mtext(expression(italic(Normal 3 )) ,1 , line=1, at=3) mtext(expression(italic(Higher 2 )) ,1 , line=1, at=4) mtext(expression(italic(Normal 3 )) ,1 , line=1, at=5) mtext(expression(italic(Higher 3 )) ,1 , line=1, at=6) As the word Higher includes a descending letter (g), this factor name ends up higher. I must say I have never encountered a software that uses the typographical descender instead of the baseline to align text . Does anyone know how to make R use the baseline instead? Perhaps using adj or padj? Or do I have to do something silly as adding g, col=white to each mtext-line to trick R into aligning the names. Cheers Andreas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Lattice barchart with different fill pattern
Dear list, I am new to lattice plots. I want to make a barchart with 10 and more levels. I need to use a grey scale for printing purposes. The problem is that with 10 or more levels in factors it is very difficult to distinguish each level in the plot and legend, since the greys are very similar (some levels have value of zero and don't appear). Here is an example of my problem: df - data.frame(year = rep(1996:2005,10), spe = c(rep(aa,10), rep(bb,10), rep(cc,10), rep(dd,10), rep(ee,10), rep(ff,10), rep(gg,10), rep(hh,10),rep(ii,10),rep(jj,10)), value = sample( c(0:10),100 , replace=TRUE) ) require(lattice) barchart( value ~ factor(year), groups = spe, data=df, stack = TRUE, main=, xlab=, auto.key = list(points = FALSE, rectangles = TRUE, space = right ), par.settings = list(superpose.polygon = list(col = gray.colors(10) ), scales = list(cex=0.8, rot=c(90,0,0))) ) I was thinking that by changing the fill pattern, the different levels could be better distinguished. I have read the lattice help and searched in the mailing list archives, but did no find any solution for lattice barchart. Is there a way to change the fill pattern of the bar levels or any other approach to help in the identification of the different levels in the barchart? Many thanks. Rafael Duarte OS: windows XP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lasso for variable selection
For importance it's probably best to stick with absolute values of coefficients, instead of value of the penalty parameter for which the coefficients changed to non-zero. Friedman skipped a lot of details on his rule ensemble in that talk, due to time constraint. In his implementation he was using his own algorithm, PathSeeker, for which paper and software are available on his web page. PathSeeker is a different generalization of LASSO than LAR. HTH, Andy From: zubin Attended JSM last week and Friedman mentioned the use of LASSO for variable selection (he uses it for rules ensembles). I am an econometrician and not familiar with, i started running the examples in R this week and you get to the plots section of the LARS package. Plots of beta/max(beta) vs standardized coefficients. How does one interpret them? u see plots of each variable converging to zero at different times - its pretty cool - but can i use this for variable importance? for variable selection - i have a group of correlated variables that we need to determine importance in predicting change of a Y variable. -zubin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Auto-save possible in R?
You could try something like: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/0334.html replacing the time-stamp with save.image() or save(). Not sure how it works in BATCH though... HTH, Andy From: John Morrow Hello fellow R'ers, I have a simple calculation with a very large data set being generated (34.9 million values) on a somewhat unreliable XP box that will likely take ~ 74hrs. I wanted to know if there is a way to have my script automatically save.image() throughout the calculation in case of a crash. This could be on the basis of output generated or time elapsed. I checked the archive, and only got a hint of it from: https://stat.ethz.ch/pipermail/r-help/1997-May/001611.html Any quick suggestions would be greatly appreciated, John Morrow [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rpvm/snow packages on a cluster with dual-processor machi nes
That's what I've tried before, on three dual-Xeon boxes, so I know it worked (as documented a that time). Andy From: Paul Y. Peng Luke Tierney just reminded me that makeCluster() can take a number greater than the number of machines in a cluster. It seems to be a solution to this problem. But I haven't tested it yet. Paul. Ryan Austin wrote: Hi, Adding a node twice gives a duplicate node error. However, adding the parameter sp=2000 to your pvm hostfile should enable dual processors. Ryan Liaw, Andy wrote: Caveat: I've only played with this a couple of years ago... I believe you can just add each host _twice_ (or as many times as the number of CPUs at that host) to get both CPUs to work. Andy From: Paul Y. Peng Hi, does anybody know how to use the dual processors in the machines of a cluster? I am using R with rpvm and snow packages. I usually start pvm daemon and add host machines first, and then run R to start my computing work. But I find that only one processor in each machine is used in this way and the other one always stays idle. Is there any simple way to tell pvm to use the two processors at the same time? In other words, I would like to see two copies of R running on each machine's two processors when using pvm. Any hints/help are greatly appreciated. Paul. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] left-justified fixed-width format
I need to save data in fixed-width format without headers and reading the help archive leads me to believe that sprintf is pretty much the only way to do this. My question is, is there anyway to change the output so the text in each column is left justified instead of right justified? My code sample is below where comb is the data frame. TIA, Roger out - sprintf(%6s %22s %8s %15s %7s %5s, comb$tic, substr(as.character(comb$conm), 1, 22), comb$cusip, comb$type, comb$exchange, comb$currency) write.table(out, file=c:/pit/portia_test.txt, row.names=FALSE, col.names=FALSE, quote=FALSE) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lme() F-values disagree with aov()
I have used lme() on data from a between-within subjects experiment. The correct ANOVA table is known because this is a textbook example (Experimental Design by Roger Kirk Chapter 12: Split-Plot Factorial Design). The lme() F-values differ from the known results. Please help me understand why. d-read.table(kirkspf2.dat,header=TRUE) for(j in 1:4) d[,j] - factor(d[,j]) ### Make vars into type factor ##lme() results library(nlme) fit-lme(y~a*b*c,random=~1|s, data=d) anova(fit) ##correct anova table ##subjects are nested within a; a between, b c within fit2-aov(y ~ a*b*c + Error(s/(c*b)), data=d) summary(fit2) I suspect I need a different random=... statement in lme(). Thanks very much for any help Bill The data file is attached -- kirkspf2.dat Here it is again: s a c b y 1 1 1 1 3 1 1 1 2 7 1 1 2 1 4 1 1 2 2 7 2 1 1 1 6 2 1 1 2 8 2 1 2 1 5 2 1 2 2 8 3 1 1 1 3 3 1 1 2 7 3 1 2 1 4 3 1 2 2 9 4 1 1 1 3 4 1 1 2 6 4 1 2 1 3 4 1 2 2 8 5 2 1 1 1 5 2 1 2 5 5 2 2 1 2 5 2 2 2 10 6 2 1 1 2 6 2 1 2 6 6 2 2 1 3 6 2 2 2 10 7 2 1 1 2 7 2 1 2 5 7 2 2 1 4 7 2 2 2 9 8 2 1 1 2 8 2 1 2 6 8 2 2 1 3 8 2 2 2 11 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mtext uses the typographical descender to align text
Andreas Svensson [EMAIL PROTECTED] writes: Hello One sometimes (quite often really ) marvel at the choice of defaults in R's graphic engine. For some obscure reason, mtext uses the typographical descender (bottom of letters) to align text. That is: gG will end up slightly higher that GG. Depending on the font, Q might end up higher than O. (for explanation of baseline descender see: http://www.paratype.com/help/term/terms.asp?code=88) snip mtext(expression(italic(Normal 1)) ,1 , line=1, at=1) snap As the word Higher includes a descending letter (g), this factor name ends up higher. I must say I have never encountered a software that uses the typographical descender instead of the baseline to align text . Does anyone know how to make R use the baseline instead? Perhaps using adj or padj? Or do I have to do something silly as adding g, col=white to each mtext-line to trick R into aligning the names. Notice that it only happens when plotting math expressions. Using mtext(Normal 1 ,1 , line=1, at=1,font=3) mtext(Higher 1 ,1 , line=1, at=2, font=3) etc. does not exhibit the same effect. I suppose the idea is that math expressions can grow arbitrarily tall or deep, and that the design decision (wise or not) has been to align on the bounding box of the whole enchilada. For a workaround, if you do need to do it with expressions, notice the phantom() construction. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice barchart with different fill pattern
On 8/14/06, Rafael Duarte [EMAIL PROTECTED] wrote: Dear list, I am new to lattice plots. I want to make a barchart with 10 and more levels. I need to use a grey scale for printing purposes. The problem is that with 10 or more levels in factors it is very difficult to distinguish each level in the plot and legend, since the greys are very similar (some levels have value of zero and don't appear). Here is an example of my problem: df - data.frame(year = rep(1996:2005,10), spe = c(rep(aa,10), rep(bb,10), rep(cc,10), rep(dd,10), rep(ee,10), rep(ff,10), rep(gg,10), rep(hh,10),rep(ii,10),rep(jj,10)), value = sample( c(0:10),100 , replace=TRUE) ) Nothing to do with your problem, but 'rep' has an argument 'each' which would shorten the call above. require(lattice) barchart( value ~ factor(year), groups = spe, data=df, stack = TRUE, main=, xlab=, auto.key = list(points = FALSE, rectangles = TRUE, space = right ), par.settings = list(superpose.polygon = list(col = gray.colors(10) ), scales = list(cex=0.8, rot=c(90,0,0))) ) I was thinking that by changing the fill pattern, the different levels could be better distinguished. I have read the lattice help and searched in the mailing list archives, but did no find any solution for lattice barchart. Is there a way to change the fill pattern of the bar levels or any other approach to help in the identification of the different levels in the barchart? Unfortunately, no. lattice depends on the grid package for rendering, and last time I checked, grid didn't have support for fill patterns. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] left-justified fixed-width format
On Mon, 14 Aug 2006, roger bos wrote: I need to save data in fixed-width format without headers and reading the help archive leads me to believe that sprintf is pretty much the only way to do this. My question is, is there anyway to change the output so the text in each column is left justified instead of right justified? My code sample is below where comb is the data frame. TIA, Roger format can do this, easily. And for sprintf, use the '-' flag documented on the help page(!): sprintf(%22s, foo) [1]foo sprintf(%-22s, foo) [1] foo -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lme() F-values disagree with aov()
Your lme statement is OK. To get the usual split-plot anova, your aov statement should be fit2 - aov(y ~ a*b*c + Error(s), data = d) This gives the same F-values as lme. On Mon, Aug 14, 2006 at 10:27:19AM -0400, William Simpson wrote: I have used lme() on data from a between-within subjects experiment. The correct ANOVA table is known because this is a textbook example (Experimental Design by Roger Kirk Chapter 12: Split-Plot Factorial Design). The lme() F-values differ from the known results. Please help me understand why. d-read.table(kirkspf2.dat,header=TRUE) for(j in 1:4) d[,j] - factor(d[,j]) ### Make vars into type factor ##lme() results library(nlme) fit-lme(y~a*b*c,random=~1|s, data=d) anova(fit) ##correct anova table ##subjects are nested within a; a between, b c within fit2-aov(y ~ a*b*c + Error(s/(c*b)), data=d) summary(fit2) I suspect I need a different random=... statement in lme(). Thanks very much for any help Bill The data file is attached -- kirkspf2.dat Here it is again: s a c b y 1 1 1 1 3 1 1 1 2 7 1 1 2 1 4 1 1 2 2 7 2 1 1 1 6 2 1 1 2 8 2 1 2 1 5 2 1 2 2 8 3 1 1 1 3 3 1 1 2 7 3 1 2 1 4 3 1 2 2 9 4 1 1 1 3 4 1 1 2 6 4 1 2 1 3 4 1 2 2 8 5 2 1 1 1 5 2 1 2 5 5 2 2 1 2 5 2 2 2 10 6 2 1 1 2 6 2 1 2 6 6 2 2 1 3 6 2 2 2 10 7 2 1 1 2 7 2 1 2 5 7 2 2 1 4 7 2 2 2 9 8 2 1 1 2 8 2 1 2 6 8 2 2 1 3 8 2 2 2 11 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- *I.White * *University of Edinburgh * *Ashworth Laboratories, West Mains Road* *Edinburgh EH9 3JT * *Fax: 0131 650 6564 Tel: 0131 650 5490 * *E-mail: [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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] lme() F-values disagree with aov()
Your lme statement is OK. To get the usual split-plot anova, your aov statement should be fit2 - aov(y ~ a*b*c + Error(s), data = d) No, this gives wrong F-values. By wrong I mean it does not agree with the published table. Table 12.10-2, page 559: Number of obs = 32 R-squared = 0.9920 Root MSE = .559017 Adj R-squared = 0.9589 Source | Partial SSdf MS F Prob F ---+ Model | 233.62525 9.345 29.90 0.0002 | a | 3.125 1 3.125 2.00 0.2070 s|a | 9.375 6 1.5625 ---+ b | 162.00 1 162.00 199.38 0. a*b | 6.125 1 6.125 7.54 0.0335 b*s|a | 4.875 6 .8125 ---+ c | 24.50 1 24.50 61.89 0.0002 a*c | 10.125 1 10.125 25.58 0.0023 c*s|a | 2.375 6 .39583 ---+ b*c |8.00 18.00 25.60 0.0023 a*b*c | 3.125 1 3.125 10.00 0.0195 | Residual | 1.875 6 .3125 ---+ Total | 235.5031 7.59677419 Bill __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to order or sort a data.frame
--- Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: try the following: mdf - data.frame(us.state, count, year, month) mdf[order(mdf$year, mdf$month), ] Thansk to Dimitris and Dieter. This has helped since seems to have shown me a way around the problem. It just means that I have to sort the data earlier. What my example did not show clearly is that when I subset the data the variable 'month' which is numeric in the original dataframe becomes a factor. I was wondering if there was a way to sort the factor so that I would get a numeric sort. So far I have not been able to see how to coerce the factor month into a numeric when using 'order Thanks for helpl. Hi Hadley, I have not had time to check out the reshape but thanks. Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting John Kane [EMAIL PROTECTED]: I have a dataframe where I would like to order first by variable, year, and then within that variable by month. So far the only way that I have seen to do this is to order by year and then subset year and sort by month and then do an rbind to get things back together. Is this the right approach? Example: us.state -rep(California, 23) count - c(774,283,774,283,508,283,774,283,602,283, 774,508,0,602,330,283,283,283,602,301,126, NA,301) year - c(2002, 2003, 2001, 2002, 2001, 2002, 2001, 2002, 2002, 2003, 2002, 2002, 2001, 2002, 2001, 2002, 2001, 2002, 2001, 2002, 2001, 2001, 2002) month - c( 1, 1, 10, 10, 11, 11, 12, 12, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9) df - data.frame (cbind(us.state,count, year, month)) # ordering as a factor works here df1 - df[order(df$year),] df1 df2 - subset(df1, year==2001) # ordering as a factor works but not a good appearance. df3 - df2[order(as.numeric(df2$month)),] df3 This works but month is ordered as a factor and I would prefer to coerce it into a numeric for presentation purposes but df3 - df2[order(as.numeric(df2$month)),] does not seem to work, nor has a couple of other things I've tried. Any suggestions gratefully received. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with glmmPQL
Hello Folks- Is there a way to create confidence bands with 'glmmPQL' ??? I am trying to decide a way to best plot the model which we created with the glmmPQL function in R. I would like to plot my actual averaged data points within 95 % confidence intervals from the model. Plotting the model is easy, but determining confidence bands is not. Here is my model: ratiomodel-glmmPQL(ratio~as.factor(joint)*time, random = ~ 1 | subject, family = Gamma(link = identity),alldata3) If I use 'lm' and pass the command 'int = c ' 'to create this model I can easily find and plot this type of confidence band for 'ratio~time'. But I need to take into account 'as.factor(joint)', and in fact I can produce confidence bands with 'glm' by passing in 'se.fit = TRUE', but the problem is I need to make subject a random variable, and take into account my ratio with the Gamma distribution. Is there a way to create confidence bands with 'glmmPQL' ??? ' as.factor(joint)' has 3 levels, so I would like to produce this linear model with three levels and confidence bands for comparison of the levels of 'joint'. Any Help at all with my problem would be greatly appreciated!! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] solving non-linear system of equations
Didn't get any useful response to the following question. Trying again. I can't seem to get computationally stable estimates for the following system: Y=a+bX+cX^2+dX^3, where X~N(0,1). (Y is expressed as a linear combination of the first three powers of a standard normal variable.) Assuming that E(Y)=0 and Var(Y)=1, one can obtain the following equations after tedious algebraic calculations: 1) b^2+6bd+2c^2+15d^2=1 2) 2c(b^2+24bd+105d^2+2)=E(Y^3) 3) 24[bd+c^2(1+b^2+28bd)+d^2(12+48bd+141c^2+225d^2)]=E(Y^4)-3 Obviously, a=-c. Suppose that distributional form of Y is given so we know E(Y^3) and E(Y^4). In other words, we have access to the third and fourth raw moments. How do we solve for these four coefficients? I reduced the number of unknowns/equations to two, and subsequently used a grid approach. It works well when I am close to the center of the support, but fails at the tails. Any ideas? Hakan Demirtas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lme() F-values disagree with aov()
William Simpson [EMAIL PROTECTED] writes: Your lme statement is OK. To get the usual split-plot anova, your aov statement should be fit2 - aov(y ~ a*b*c + Error(s), data = d) No, this gives wrong F-values. By wrong I mean it does not agree with the published table. Well, it's the model that is equivalent to your lme() model Thing is that you want to add random effects of s:b and s:c, which are crossed factors, so somewhat tricky to code with lme() (this sort of thing is easier in lmer() from the lme4 packages). The generic way to handle this in lme() is via something like random=list(s=pdBlocked(list( pdIdent(~1), pdIdent(~b-1), pdIdent(~c-1 You probably won't get the degrees of freedom right, though. Table 12.10-2, page 559: Number of obs = 32 R-squared = 0.9920 Root MSE = .559017 Adj R-squared = 0.9589 Source | Partial SSdf MS F Prob F ---+ Model | 233.62525 9.345 29.90 0.0002 | a | 3.125 1 3.125 2.00 0.2070 s|a | 9.375 6 1.5625 ---+ b | 162.00 1 162.00 199.38 0. a*b | 6.125 1 6.125 7.54 0.0335 b*s|a | 4.875 6 .8125 ---+ c | 24.50 1 24.50 61.89 0.0002 a*c | 10.125 1 10.125 25.58 0.0023 c*s|a | 2.375 6 .39583 ---+ b*c |8.00 18.00 25.60 0.0023 a*b*c | 3.125 1 3.125 10.00 0.0195 | Residual | 1.875 6 .3125 ---+ Total | 235.5031 7.59677419 Bill __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lme() F-values disagree with aov()
Thanks very much Peter! Your lme statement is OK. To get the usual split-plot anova, your aov statement should be fit2 - aov(y ~ a*b*c + Error(s), data = d) No, this gives wrong F-values. By wrong I mean it does not agree with the published table. Well, it's the model that is equivalent to your lme() model Yes, I thought my lme() model was wrong but couldn't figure out how to do it properly. Thing is that you want to add random effects of s:b and s:c, which are crossed factors, so somewhat tricky to code with lme() (this sort of thing is easier in lmer() from the lme4 packages). I am happy to do it that way if you show me how... The generic way to handle this in lme() is via something like random=list(s=pdBlocked(list( pdIdent(~1), pdIdent(~b-1), pdIdent(~c-1 I see. Thanks very much Peter!! Bill __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mtext uses the typographical descender to align text
Hi The reason I use expression is to get italics. Perhaps this is possible some other way? /A Peter Dalgaard wrote: Andreas Svensson [EMAIL PROTECTED] writes: Hello One sometimes (quite often really ) marvel at the choice of defaults in R's graphic engine. For some obscure reason, mtext uses the typographical descender (bottom of letters) to align text. That is: gG will end up slightly higher that GG. Depending on the font, Q might end up higher than O. (for explanation of baseline descender see: http://www.paratype.com/help/term/terms.asp?code=88) snip mtext(expression(italic(Normal 1)) ,1 , line=1, at=1) snap As the word Higher includes a descending letter (g), this factor name ends up higher. I must say I have never encountered a software that uses the typographical descender instead of the baseline to align text . Does anyone know how to make R use the baseline instead? Perhaps using adj or padj? Or do I have to do something silly as adding g, col=white to each mtext-line to trick R into aligning the names. Notice that it only happens when plotting math expressions. Using mtext(Normal 1 ,1 , line=1, at=1,font=3) mtext(Higher 1 ,1 , line=1, at=2, font=3) etc. does not exhibit the same effect. I suppose the idea is that math expressions can grow arbitrarily tall or deep, and that the design decision (wise or not) has been to align on the bounding box of the whole enchilada. For a workaround, if you do need to do it with expressions, notice the phantom() construction. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question on .Options$max.print
Hi, I have a tiny question concerning .Options$max.print I have to set up this value to a greater value than 1 because I want to concatenate my output of a function to one single string (for connivence). I did this via .Options$max.print - 64000 or options(max.print=64000) Then I call out - paste(out, blabla) several times, but nchar(out) is never larger than 1. I read in the help about '.Options' that this is not yet used in base R. Could this be my problem? Thanks for any hint Hans BTW I believe, there is a typo within the help page about '.Options' ... The ‘factory-fresh’ default settings of some of these options are ... max.print 1000 ... This should be ... max.print 1 ... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mtext uses the typographical descender to align text
Andreas Svensson wrote: Hi The reason I use expression is to get italics. Perhaps this is possible some other way? 1. Yes, see ?mtext: plot(1:10) mtext(Hello World, 3, font=3) 2. expression() has to use bounding boxes for several reasons, in particular fractions spring to mind at once. Solutions as Peter suggested: plot(1:10) mtext(expression(Hello World * phantom(g)), 3) Uwe Ligges /A Peter Dalgaard wrote: Andreas Svensson [EMAIL PROTECTED] writes: Hello One sometimes (quite often really ) marvel at the choice of defaults in R's graphic engine. For some obscure reason, mtext uses the typographical descender (bottom of letters) to align text. That is: gG will end up slightly higher that GG. Depending on the font, Q might end up higher than O. (for explanation of baseline descender see: http://www.paratype.com/help/term/terms.asp?code=88) snip mtext(expression(italic(Normal 1)) ,1 , line=1, at=1) snap As the word Higher includes a descending letter (g), this factor name ends up higher. I must say I have never encountered a software that uses the typographical descender instead of the baseline to align text . Does anyone know how to make R use the baseline instead? Perhaps using adj or padj? Or do I have to do something silly as adding g, col=white to each mtext-line to trick R into aligning the names. Notice that it only happens when plotting math expressions. Using mtext(Normal 1 ,1 , line=1, at=1,font=3) mtext(Higher 1 ,1 , line=1, at=2, font=3) etc. does not exhibit the same effect. I suppose the idea is that math expressions can grow arbitrarily tall or deep, and that the design decision (wise or not) has been to align on the bounding box of the whole enchilada. For a workaround, if you do need to do it with expressions, notice the phantom() construction. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] split a y-axis to show data on different scales
The pro's and con's of using scale breaks were discussed by Cleveland (1985) The Elements of Graphing Data (Wadsworth, pp. 85-91, 149). I don't know what Cleveland said about this is the second edition of this book, but I believe there are times when scale breaks are appropriate, but the display should make this nonstandard transition very clear; otherwise, it can be seriously misleading. Hope this helps. Spencer Graves Jim Lemon wrote: Rashmi Mathur wrote: Hello, How do I split a y-axis to plot data on different scales? Eg: x - 1:10 y - c(-0.01,0.79,0.74,0.55,-0.67,0.32,-0.47,-0.05,723,759) plot(x,y) I'd like to show these data on the same plot, but the way it's written, all contrast in the first 8 data points is lost. Can R split a y-axis for me? Hi Rashmi, Although Hadley's answer is relevant (displaying vastly different ranges of data can be dangerous) you might find that gap.plot in the plotrix package will do the dirty deed. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question on .Options$max.print
HansJB == Hans-Joerg Bibiko [EMAIL PROTECTED] on Mon, 14 Aug 2006 17:56:30 +0200 writes: HansJB Hi, I have a tiny question concerning HansJB .Options$max.print HansJB I have to set up this value to a greater value than HansJB 1 because I want to concatenate my output of a HansJB function to one single string (for connivence). HansJB I did this via .Options$max.print - 64000 or HansJB options(max.print=64000) HansJB Then I call out - paste(out, blabla) several times, HansJB but nchar(out) is never larger than 1. HansJB I read in the help about '.Options' that this is not HansJB yet used in base R. Could this be my problem? well, it at least makes clear that your assumption that this option would influence your paste() must be wrong. I don't think there's any option influencing paste() and I hope there won't every be any. Options typically should only influence ``output formatting'' but not the result of a ``computational'' (i.e. non-printing/plotting) function. HansJB Thanks for any hint The posting guide -- and every footer of all R-help posting asks for a small reproducible example of R code. So please do provide one [and, BTW, keep this thread on R-help; do not reply privately..] HansJB Hans HansJB BTW I believe, there is a typo within the help page HansJB about '.Options' HansJB ... The ?factory-fresh? default settings of some HansJB of these options are ... max.print 1000 ... HansJB This should be ... max.print 1 ... Yes, thank you. Martin Maechler, ETH Zurich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Attempt to access unmapped memory
Hi, I am usiing R 2.3.1 under Linux kernel 2.6.11 with libreadline/libhistory 5.1. Bothe R and readline were compiled without quircks with gcc 3.3.3 and g77. Every time I try to edit command line by using del key the following error happens: 8-- ipacks - instaleld.packages() *** caught segfault *** address (nil), cause 'memory not mapped' Possible actions: 1: abort (with core dump) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection: Segmentation fault 8-- As I have readline 4.3 installed too, I adjusted the symlinks to point to 5.1. No problem with bash. This setup works fine in another machine with same OS and versions. Any clues? Thanks in advance. -- Alexandre Aguiar Independent consultant for medical research SPS Consultoria Voice: +55-11-9320-2046 Fax: +55-11-5549-8760 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to reply to a thread if receiving R-help mails in digest form
At 14:21 13/08/2006, Dirk Enzmann wrote: I receive R-help messages in digest form that makes it difficult to answer a post. I noticed that my answer is not added to the thread (instead, a new thread is started) although I use the same subject line (starting with Re: ) as the original post. Is there a solution (I prefer the digest to separate messages for several reasons and don't want to change my email reader)? Dirk, I asked some while ago for people to tell me how they read digests in their news reader so I could put together a list of helpful hints. Unfortunately I got nowhere. In the email client I use (Eudora) there is an option to receive digests as attachments (as Ted Harding has also outlined in another email. It is rather hidden so I suspect if you can do it in Thunderbird it will be similarly hidden. Try looking for such an option and let me know if you find it. The way I answer post up to now is: 1) I press the reply button of my email program (Mozilla / Thunderbird, Windows) 2) I delete all contents of the digest except for the post (including name and mail address of the posting person) I want to answer so that the original question will be included (cited) in my answer. 3) I add the email address to the individual sender to cc: to the automatically generated address of the R-help list. 4) I replace the automatically generated subject line (for example Re: R-help Digest, Vol 42, Issue 13 by Re: followed by a copy of the original subject line of the post. 5) I write my answer and send the mail to the mailing list. It's not that this is tedious - the problem is that the thread is broken. Is there a better way even if I want to keep receiving messages in digest form? The posting guide is silent about this. Dirk * Dr. Dirk Enzmann Institute of Criminal Sciences Dept. of Criminology Edmund-Siemers-Allee 1 D-20146 Hamburg Germany phone: +49-(0)40-42838.7498 (office) +49-(0)40-42838.4591 (Billon) fax: +49-(0)40-42838.2344 email: [EMAIL PROTECTED] www: http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html Michael Dewey http://www.aghmed.fsnet.co.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Vector Join
At 13:23 13/08/2006, Michael Zatorsky wrote: Hi, I'm working on producing a simple cumulative frequency distribution. Thanks to the help of the good people on this list I now have four vectors that I'd like to join/relate into a table. e.g. v1 - myHistogram$breaks # classes v2 - myHistogram$counts # freqs v3 - cumsum(v2) # cumulative freq v4 - ((v3 / length(myData)) * 100) # cumulative % data.frame(v1 = myHistogram$breaks, v2 = myHistogram$counts, and so on ...) What is the recommend approach to turning these into a single table with four columns? ie effectively doing a relational join on row id? The goal is to ultimately have the data with one row per class in a format I can write out to a text file as: v1v2v3v4 v1v2v3v4 etc... Any advice will be appreciated. Regards Michael. Coming soon: Celebrity Survivor - 11 celebrities, 25 days, unlimited drama Michael Dewey [EMAIL PROTECTED] http://www.aghmed.fsnet.co.uk/home.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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] solving non-linear system of equations
Are you saying you did not receive my reply stamped 8/10/2006 2:12 AM in my Sent folder, or that my reply was not useful? In case the former is correct, my comments were as follows: Have you tried writing a function to compute SS = sum of squares deviations between the the left and right hand sides of your three equations, then using 'optim'? See also Venables and Ripley (2002) Modern Applied Statistics with S, 4th ed. (Springer). p.s. I don't see how it's obvious that 'a=-c'. If you think these comments are not useful, I would appreciate the courtesy of a reply. I have solved many superficially similar problems in this way, and I would like to know why this would not work for your case. hope this helps. Spencer Graves HAKAN DEMIRTAS wrote: Didn't get any useful response to the following question. Trying again. I can't seem to get computationally stable estimates for the following system: Y=a+bX+cX^2+dX^3, where X~N(0,1). (Y is expressed as a linear combination of the first three powers of a standard normal variable.) Assuming that E(Y)=0 and Var(Y)=1, one can obtain the following equations after tedious algebraic calculations: 1) b^2+6bd+2c^2+15d^2=1 2) 2c(b^2+24bd+105d^2+2)=E(Y^3) 3) 24[bd+c^2(1+b^2+28bd)+d^2(12+48bd+141c^2+225d^2)]=E(Y^4)-3 Obviously, a=-c. Suppose that distributional form of Y is given so we know E(Y^3) and E(Y^4). In other words, we have access to the third and fourth raw moments. How do we solve for these four coefficients? I reduced the number of unknowns/equations to two, and subsequently used a grid approach. It works well when I am close to the center of the support, but fails at the tails. Any ideas? Hakan Demirtas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] missing data treatment in MCMC pack
Hello, does anyone know something about missing data in the MCMC pack? thank you, Mariagiulia Mariagiulia Matteucci Dipartimento di Scienze Statistiche “Paolo Fortunati” Università di Bologna Via Belle Arti, 41 40126 Bologna (ITALY) e-mail: [EMAIL PROTECTED] TEL: +39 051 264182 FAX: +39 051 232153 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Making R script to run in a console
Hi, is possible to make a R script to run under a console without open the R environment? Something like this example.R #!/usr/bin/R function(name=Put here your name) { print(name) } In a console I make ./example.R name=Ronaldo Reis Júnior then program print my name. It is possible? Thanks Ronaldo -- A jury consists of twelve persons chosen to decide who has the better lawyer. -- Robert Frost -- Prof. Ronaldo Reis Júnior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva | : :' : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil | `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] solving non-linear system of equations
Spencer Graves [EMAIL PROTECTED] writes: p.s. I don't see how it's obvious that 'a=-c'. Y=a+bX+cX^2+dX^3, where X~N(0,1). (Y is expressed as a linear combination of the first three powers of a standard normal variable.) Assuming that E(Y)=0 and Var(Y)=1, one can obtain the following equations after tedious algebraic calculations: Take means on both sides: EY = a+0+c+0 = 0 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to order or sort a data.frame
Quoting John Kane [EMAIL PROTECTED]: --- Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: try the following: mdf - data.frame(us.state, count, year, month) mdf[order(mdf$year, mdf$month), ] Thansk to Dimitris and Dieter. This has helped since seems to have shown me a way around the problem. It just means that I have to sort the data earlier. What my example did not show clearly is that when I subset the data the variable 'month' which is numeric in the original dataframe becomes a factor. I was wondering if there was a way to sort the factor so that I would get a numeric sort. So far I have not been able to see how to coerce the factor month into a numeric when using 'order for converting factors to numeric check R FAQ 7.10. Best, Dimitris Thanks for helpl. Hi Hadley, I have not had time to check out the reshape but thanks. Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting John Kane [EMAIL PROTECTED]: I have a dataframe where I would like to order first by variable, year, and then within that variable by month. So far the only way that I have seen to do this is to order by year and then subset year and sort by month and then do an rbind to get things back together. Is this the right approach? Example: us.state -rep(California, 23) count - c(774,283,774,283,508,283,774,283,602,283, 774,508,0,602,330,283,283,283,602,301,126, NA,301) year - c(2002, 2003, 2001, 2002, 2001, 2002, 2001, 2002, 2002, 2003, 2002, 2002, 2001, 2002, 2001, 2002, 2001, 2002, 2001, 2002, 2001, 2001, 2002) month - c( 1, 1, 10, 10, 11, 11, 12, 12, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9) df - data.frame (cbind(us.state,count, year, month)) # ordering as a factor works here df1 - df[order(df$year),] df1 df2 - subset(df1, year==2001) # ordering as a factor works but not a good appearance. df3 - df2[order(as.numeric(df2$month)),] df3 This works but month is ordered as a factor and I would prefer to coerce it into a numeric for presentation purposes but df3 - df2[order(as.numeric(df2$month)),] does not seem to work, nor has a couple of other things I've tried. Any suggestions gratefully received. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ARMA(1,1) for panel data
Dear List, I am new to TS-Modeling in R. I would like to fit an ARMA(1,1) model for a balanced panel, running Y on a full set of unit and year dummies using an arma(1,1) for the disturbance: y_it=unit.dummies+yeardummies+e_it where: e_it=d*e_it-1+u_it+q*u_it-1 How can I fit this model in R? arma() does not seem to take covariates (or I don't understand how to specify the function so that it would). Thank you very much. Best, Tom __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] CircStats help
Hello, I am quite new to R and although I have read some material (apparently not enough) I'm getting very frustrated. I'm trying to do some simple circular statistics in R (CircStats, primarily circ.mean) and I'm confused about the results. What is a negative radian or degree mean in R? I thought it would be a coterminal angle, but that doesn't make sense with my data points. I'm sorry if this is trivial to most of you, but I really appreciate any help. I have tried to obtain the book this package was based on (Jammalamadaka and SenGupta 2001 Topics in Circular Statistics) but it is not available at any of my university libraries. Here is an example. The values of x are directions in degrees of one amphibian over 6 days and I'd just like to simply calculate the mean direction: x - c(5.009684,37.814266, 295.722970, 0.00, 326.463366,242.678840) radx - rad(x) circ.mean(radx) [1] -0.4283351 deg(-0.4283351) [1] -24.54179 I would just like this number to be converted to the appropriate angle between 0-360 degrees. Can someone help me? Sincerely, Isabelle Deguise MSc candidate [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] CircStats help
Isabelle Deguise ideguise at interchange.ubc.ca writes: Hello, x - c(5.009684,37.814266, 295.722970, 0.00, 326.463366,242.678840) radx - rad(x) circ.mean(radx) [1] -0.4283351 deg(-0.4283351) [1] -24.54179 I would just like this number to be converted to the appropriate angle between 0-360 degrees. Can someone help me? Just add 360 to the result ... when in doubt, you can also look at what the function is actually doing by typing the name of the function by itself, e.g. circ.mean In this case it shows that the function is just adding up the sines and cosines of the individual angles and then taking the arc-tangent. With this size problem you can work through the details and understand how it all works ... Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Attempt to access unmapped memory
On Mon, 14 Aug 2006, Alexandre Aguiar wrote: Hi, I am usiing R 2.3.1 under Linux kernel 2.6.11 with libreadline/libhistory 5.1. That is known to be buggy. Either patch it or downdate to 5.0. Bothe R and readline were compiled without quircks with gcc 3.3.3 and g77. Every time I try to edit command line by using del key the following error happens: 8-- ipacks - instaleld.packages() *** caught segfault *** address (nil), cause 'memory not mapped' Possible actions: 1: abort (with core dump) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection: Segmentation fault 8-- As I have readline 4.3 installed too, I adjusted the symlinks to point to 5.1. No problem with bash. This setup works fine in another machine with same OS and versions. Any clues? Thanks in advance. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fast way to load multiple files
Hi, Instead of having to program a loop to load several workspaces in a directory, it would be nice to store the filenames in a list filelist and then to apply load to this list lapply( filelist, load) Unfortunately, although it seems that R is loading the files, the contained objects are not available in the workspace afterwards. Any hints what I'm doing wrong or how to circumvent the problem? Peter -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to order or sort a data.frame
--- Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: Quoting John Kane [EMAIL PROTECTED]: --- Dimitrios Rizopoulos [EMAIL PROTECTED] wrote: try the following: mdf - data.frame(us.state, count, year, month) mdf[order(mdf$year, mdf$month), ] Thansk to Dimitris and Dieter. This has helped since seems to have shown me a way around the problem. It just means that I have to sort the data earlier. What my example did not show clearly is that when I subset the data the variable 'month' which is numeric in the original dataframe becomes a factor. I was wondering if there was a way to sort the factor so that I would get a numeric sort. So far I have not been able to see how to coerce the factor month into a numeric when using 'order for converting factors to numeric check R FAQ 7.10. Best, Dimitris Argh! Of course. I should never trust my memory! Thanks. Thanks for helpl. Hi Hadley, I have not had time to check out the reshape but thanks. Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting John Kane [EMAIL PROTECTED]: I have a dataframe where I would like to order first by variable, year, and then within that variable by month. So far the only way that I have seen to do this is to order by year and then subset year and sort by month and then do an rbind to get things back together. Is this the right approach? Example: us.state -rep(California, 23) count - c(774,283,774,283,508,283,774,283,602,283, 774,508,0,602,330,283,283,283,602,301,126, NA,301) year - c(2002, 2003, 2001, 2002, 2001, 2002, 2001, 2002, 2002, 2003, 2002, 2002, 2001, 2002, 2001, 2002, 2001, 2002, 2001, 2002, 2001, 2001, 2002) month - c( 1, 1, 10, 10, 11, 11, 12, 12, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9) df - data.frame (cbind(us.state,count, year, month)) # ordering as a factor works here df1 - df[order(df$year),] df1 df2 - subset(df1, year==2001) # ordering as a factor works but not a good appearance. df3 - df2[order(as.numeric(df2$month)),] df3 This works but month is ordered as a factor and I would prefer to coerce it into a numeric for presentation purposes but df3 - df2[order(as.numeric(df2$month)),] does not seem to work, nor has a couple of other things I've tried. Any suggestions gratefully received. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fast way to load multiple files
A reproducible example here would help (please see posting guide). A guess: is your filelist a list of (quoted) character strings? Correct pathnames to the files with correct separators for your OS? -- 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 Peter Eiger Sent: Monday, August 14, 2006 1:00 PM To: r-help@stat.math.ethz.ch Subject: [R] Fast way to load multiple files Hi, Instead of having to program a loop to load several workspaces in a directory, it would be nice to store the filenames in a list filelist and then to apply load to this list lapply( filelist, load) Unfortunately, although it seems that R is loading the files, the contained objects are not available in the workspace afterwards. Any hints what I'm doing wrong or how to circumvent the problem? Peter -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making R script to run in a console
On Mon, 2006-08-14 at 14:12 -0300, Ronaldo Reis-Jr. wrote: Hi, is possible to make a R script to run under a console without open the R environment? Something like this example.R #!/usr/bin/R function(name=Put here your name) { print(name) } In a console I make ./example.R name=Ronaldo Reis Júnior then program print my name. It is possible? Thanks Ronaldo Ronaldo, You might want to review these web pages: http://wiki.r-project.org/rwiki/doku.php?id=developers:rinterp http://kavaro.fi/mediawiki/index.php/Using_R_from_the_shell HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Fast way to load multiple files
On Mon, 14 Aug 2006, Berton Gunter wrote: A reproducible example here would help (please see posting guide). A guess: is your filelist a list of (quoted) character strings? Correct pathnames to the files with correct separators for your OS? I think the issue is (from the help page) Usage: load(file, envir = parent.frame()) ^^ Arguments: file: a (readable binary) connection or a character string giving the name of the file to load. envir: the environment where the data should be loaded. and so they were not loaded into .GlobalEnv. Try lapply(filelist, load, envir=.GlobalEnv) which works for me. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Eiger Sent: Monday, August 14, 2006 1:00 PM To: r-help@stat.math.ethz.ch Subject: [R] Fast way to load multiple files Hi, Instead of having to program a loop to load several workspaces in a directory, it would be nice to store the filenames in a list filelist and then to apply load to this list lapply( filelist, load) Unfortunately, although it seems that R is loading the files, the contained objects are not available in the workspace afterwards. Any hints what I'm doing wrong or how to circumvent the problem? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making R script to run in a console
Le 14.08.2006 19:12, Ronaldo Reis-Jr. a écrit : Hi, is possible to make a R script to run under a console without open the R environment? Something like this example.R #!/usr/bin/R function(name=Put here your name) { print(name) } In a console I make ./example.R name=Ronaldo Reis Júnior then program print my name. It is possible? Thanks Ronaldo Hi, take a look at that wiki page : http://wiki.r-project.org/rwiki/doku.php?id=developers:rinterp Cheers, Romain -- +---+ | Romain FRANCOIS | | R Graph Gallery : http://addictedtor.free.fr/graphiques | `---+ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Call for Beta Testers: R+ (read R plus) for Solaris and Linux:
At 12:21 PM 8/8/2006, [EMAIL PROTECTED] wrote: We look forward to hearing your comments and inputs on R+ ... please feel free to suggest a final name for our commercially supported R. I don´t understanding this mail. Is possible exist a commercial version of R? If R source is licensed for GPL as free software other people can make a commercial version? []s Tura __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Making R script to run in a console
Em Seg 14 Ago 2006 17:58, Marc Schwartz (via MN) escreveu: http://kavaro.fi/mediawiki/index.php/Using_R_from_the_shell I made a small change to the wrapper example by implementing dynamic allocation of memory and sizing the command line buffer to 32768 that is the real maximum size (at least under bash/sh :-). #include stdio.h /* file i/o functions */ #include string.h /* string functions */ #include stdlib.h /* malloc and exit codes */ /* * R_HOME has to be defined. Usually it is /usr/lib/R * todo: copy all command line params to R */ int main(int argc, char **argv) { /* should be enough for all */ char *cmd, l; FILE *out; /* without this if a segmentation fault will happen if no parameters are passed */ if(argc == 1) return(EXIT_FAILURE); /* dynamically allocates memory for command line buffer */ cmd=(char *)malloc(32768); /* assemble command line */ strcpy(cmd,/usr/lib/R/bin/exec/R --vanilla --slave ); strcat(cmd,argv[1]); /* do the real job */ out=popen(cmd,r); l = fgetc(out); printf(%c,l); while(l != EOF) { l = fgetc(out); if(l !=EOF) printf(%c,l); } /* cleanup: close files and free memory */ pclose(out); free((void *)cmd); return(EXIT_SUCCESS); } -- Alexandre Aguiar Independent consultant for medical research SPS Consultoria Voice: +55-11-9320-2046 Fax: +55-11-5549-8760 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with workaround for: Function '`[`' is not in the derivatives table
# This works fine: a - 1 b - 2 c - 3 E - expression(a * exp(b*X) + c) X - c(0.5, 1.0, 2.0) eval(E) [1] 5.718282 10.389056 57.598150 D(E, b) a * (exp(b * X) * X) eval(D(E, b)) [1] 1.359141 7.389056 109.196300 # But if (a,b,c) are replaced with (A[1], A[2], A[3]), how can I get a derivative using D? A - c(1, 2, 3) E - expression(A[1] * exp(A[2]*X) + A[3]) X - c(0.5, 1.0, 2.0) eval(E) [1] 5.718282 10.389056 57.598150 # Why doesn't this work? Any workarounds? D(E, A[2]) Error in D(E, A[2]) : Function '`[`' is not in the derivatives table If I want to have a long vector of coefficients, A, (perhaps dozens) how can I use D to compute partial derivatives? Thanks for any help with this. efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Alexandre MENICACCI/Daix/RED/GroupeFournier est absent(e).
Je serai absent(e) du 14/08/2006 au 21/08/2006. Je répondrai à votre message dès mon retour. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Call for Beta Testers: R+ (read R plus) for Solaris and L inux:
Note that it's commercially supported, not just commercial. Also, commercial does not mean closed source. Open source (and even GPL) and commercial need not be mutually exclusive. Remember that the free in free software is as in freedom rather than as in beer (as far as GPL is concern, at least). Having commercial support for R may not be a bad thing: It may well help adaptation in the corporate world. (Linux probably would not have made inroads into large corps if not for companies providing commercial support for it.) It would be great if those who profited from R can contribute back to the project in some way. Just my $0.02... Andy _ From: [EMAIL PROTECTED] on behalf of Bernardo Rangel tura Sent: Mon 8/14/2006 5:25 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] Call for Beta Testers: R+ (read R plus) for Solaris and Linux: [Broadcast] At 12:21 PM 8/8/2006, [EMAIL PROTECTED] wrote: We look forward to hearing your comments and inputs on R+ ... please feel free to suggest a final name for our commercially supported R. I don´t understanding this mail. Is possible exist a commercial version of R? If R source is licensed for GPL as free software other people can make a commercial version? []s Tura __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with workaround for: Function '`[`' is not in thederivatives table
I think this is the sort of problem which is most elegantly handled by computing on the language. Here is an INelegant solution: A - c(1, 2, 3) for(i in 1:3)assign(paste('A',i,sep=''),A[i]) E - expression(A1 * exp(A2*X) + A3) ## could also use substitute() here, I think ## instead of explicitly assigning the coefficients X - c(0.5, 1.0, 2.0) eval(E) [1] 5.718282 10.389056 57.598150 D(E, A2) A1 * (exp(A2 * X) * X) Bert Gunter Genentech -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Earl F. Glynn Sent: Monday, August 14, 2006 3:44 PM To: r-help@stat.math.ethz.ch Subject: [R] Help with workaround for: Function '`[`' is not in thederivatives table # This works fine: a - 1 b - 2 c - 3 E - expression(a * exp(b*X) + c) X - c(0.5, 1.0, 2.0) eval(E) [1] 5.718282 10.389056 57.598150 D(E, b) a * (exp(b * X) * X) eval(D(E, b)) [1] 1.359141 7.389056 109.196300 # But if (a,b,c) are replaced with (A[1], A[2], A[3]), how can I get a derivative using D? A - c(1, 2, 3) E - expression(A[1] * exp(A[2]*X) + A[3]) X - c(0.5, 1.0, 2.0) eval(E) [1] 5.718282 10.389056 57.598150 # Why doesn't this work? Any workarounds? D(E, A[2]) Error in D(E, A[2]) : Function '`[`' is not in the derivatives table If I want to have a long vector of coefficients, A, (perhaps dozens) how can I use D to compute partial derivatives? Thanks for any help with this. efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] merge 2 data frame based on more than 2 variables
Dear Lister, I understand merge() can be used to join 2 data frames based on 1 variable. But how about merge based on more than 2 variables? Thank you so much! -- WenSui Liu (http://spaces.msn.com/statcompute/blog) Senior Decision Support Analyst Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] merge 2 data frame based on more than 2 variables
Wensui Liu wrote: Dear Lister, I understand merge() can be used to join 2 data frames based on 1 variable. But how about merge based on more than 2 variables? Thank you so much! Just specify the 2 (or more) variable names in a column vector for by) merge(dat1, dat2, by= c(VarA, VarB)) assuming both data frames have columns VarA and VarB. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] merge 2 data frame based on more than 2 variables
what if the names are different in 2 data frames? On 8/14/06, Simon Blomberg [EMAIL PROTECTED] wrote: Wensui Liu wrote: Dear Lister, I understand merge() can be used to join 2 data frames based on 1 variable. But how about merge based on more than 2 variables? Thank you so much! Just specify the 2 (or more) variable names in a column vector for by) merge(dat1, dat2, by= c(VarA, VarB)) assuming both data frames have columns VarA and VarB. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C -- WenSui Liu (http://spaces.msn.com/statcompute/blog) Senior Decision Support Analyst Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help: cannot allocate vector of length 828310236
Hi all, I was trying a probit regression using polr() and got this message, Error in model.matrix.default(Terms, m, contrasts) : cannot allocate vector of length 828310236 The data is about 20M (a few days ago I asked a question about large file, thank you for responses, then I use MS Access to select those columns I would use). R is 2.3.1, Windows XP, 512M Ram. I am going to read some help on memory use in R, but hope anybody can give me some quick hints. Is it because iphysical memory runs out, or some other things could be wrong with data or polr()? Does R use virtual memory? If so, what options can I set? If not, can R deal with really huge data (except adding RAM according to data size)? If this is the case, it is too bad that I have to tell my boss to go back to SAS. Now it is not a speed issue yet. Thank you. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] merge 2 data frame based on more than 2 variables
Then instead of by, use by.x and by.y to specifiy the variable names separately for both data frames. See ?merge, especially the examples. Wensui Liu wrote: what if the names are different in 2 data frames? On 8/14/06, Simon Blomberg [EMAIL PROTECTED] wrote: Wensui Liu wrote: Dear Lister, I understand merge() can be used to join 2 data frames based on 1 variable. But how about merge based on more than 2 variables? Thank you so much! Just specify the 2 (or more) variable names in a column vector for by) merge(dat1, dat2, by= c(VarA, VarB)) assuming both data frames have columns VarA and VarB. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.