Re: [R] Change font type PNG device with Lattice xyplot
Thanks! I found an other, less elegant, way as well. (This always happens, just after asking someone else) a-data.frame(x=c(1:5),y=c(2,2,3,3,4)) require(lattice) png(filename=let's change the font.png, width=480, height=300, pointsize=12) xyplot(y~x,data=a, ylab=list(y-axis,font=6), xlab=list(x-axis,font=6), ylim=c(0,5), par.settings=list(axis.line=list(lwd=1.5), strip.border=list(lwd=2)), scales=list(y=list(tick.number=5,tck=0.5),font=6), type=l,lwd=3,lty=1,col=2) dev.off() But I prefer yours. Regards Robbert Paul Murrell wrote: Hi Here's one way ... xyplot(y~x,data=a, ylab=y-axis, xlab=x-axis, ylim=c(0,5), par.settings=list(axis.line=list(lwd=1.5), strip.border=list(lwd=2), # This is the important bit grid.pars=list(fontfamily=mono)), scales=list(y=list(tick.number=5,tck=0.5)), type=l,lwd=3,lty=1,col=2) See ?windowsFonts for how to set up other fonts to use. Paul RBlonk wrote: Dear All, I have some problems with changing the default font (Arial) in a xyplot which is printed using the PNG-device. Although some things have been mentioned about this in the forum, I still couldn't figure it out. Can someone help me out?n Thanks in advance! I want to print the plot for pasting in Microsoft Word OS: Windows XP see example: a-data.frame(x=c(1:5),y=c(2,2,3,3,4)) png(filename=let's change the font.png, width=480, height=300, pointsize=12) xyplot(y~x,data=a, ylab=y-axis, xlab=x-axis, ylim=c(0,5), par.settings=list(axis.line=list(lwd=1.5), strip.border=list(lwd=2)), scales=list(y=list(tick.number=5,tck=0.5)), type=l,lwd=3,lty=1,col=2) dev.off() Robbert -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 p...@stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Change-font-type-PNG-device-with-Lattice-xyplot-tp23272788p23291215.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Batch importing data with respective naming
It seems that this addition works, but has created just one object called 'peak' with all the data from those 100 files. I'd like each file to have a corresponding object containing the data. Thanks for your help! On Tue, Apr 28, 2009 at 19:43, Zeljko Vrba zv...@ifi.uio.no wrote: On Tue, Apr 28, 2009 at 07:09:04PM -1000, Taylor Hermes wrote: I tried the following: Add this before for(): peak - list() for (i in 1:100) { peak[[i]] - read.table(paste(i,--one--hist.txt, sep=), sep=,, header=TRUE) } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 read the summary
On Tue, 28 Apr 2009, K. Elo wrote: mathallan wrote: How can I from the summary function, decide which glm (fit1, fit2 or fit3) fits to data best? I don't know what to look after, so I would please explain the important output. Start with the AIC value (Akaike Information Criterion). The model having the lowest AIC is the best (of the fitted models, of course). So, in Your case, the AICs are: fit1 - glm(Y~X, family=gaussian(link=identity)) AIC: 51.294 fit2 - glm(Y~X, family=gaussian(link=log)) AIC: 32.954 fit3 - glm(Y~X, family=Gamma(link=log)) AIC: 36.65 Hence, the best model seems to be 'fit2'. Except that fit3 did not use maximum likelihood to estimate the shape parameter and so that is not really a valid AIC value (and the actual AIC will be smaller since the maximized likelihood will be larger). Given that, and that AIC differences between non-nested models are highly variable I would see no clearcut difference between fit2 and fit3. (Even for nested models an AIC difference of not more than 3.7 would not be seen as a large difference.) This is not really about the subject line at all: 'AIC' as printed here is computed by glm() and not summary.glm(). There is a warning about it on the ?glm help page (all the 'AIC' values quoted here do not take account of the estimation of the dispersion parameter), and AIC() does a slightly better job. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Batch importing data with respective naming
By doing peak - list() you initialize a list and then you are adding the data objects to the list in the for loop.To access each data object just go: peaks[[i]] Where i is in [1,100]. This will return the data object you want. Adrian On Tue, Apr 28, 2009 at 11:23 PM, Taylor Hermes trher...@gmail.com wrote: It seems that this addition works, but has created just one object called 'peak' with all the data from those 100 files. I'd like each file to have a corresponding object containing the data. Thanks for your help! On Tue, Apr 28, 2009 at 19:43, Zeljko Vrba zv...@ifi.uio.no wrote: On Tue, Apr 28, 2009 at 07:09:04PM -1000, Taylor Hermes wrote: I tried the following: Add this before for(): peak - list() for (i in 1:100) { peak[[i]] - read.table(paste(i,--one--hist.txt, sep=), sep=,, header=TRUE) } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] plot.lm cex.caption
H == HighSchool2005 gemeaux...@yahoo.fr on Tue, 28 Apr 2009 06:29:07 -0700 (PDT) writes: H Hello dear R users, H My objective is to change the size of this graphic : plot(lm(a~b), 4) H (Cook's distance) H I have found the help on the internet saying to change the size of a title H on a graphic plot(lm(a ~ b), 4), I should use the graphic parameter H cex.caption H http://stat.ethz.ch/R-manual/R-patched/library/stats/html/plot.lm.html H But in my install of R, it answers cex.caption isn't a graphic parameter : H 5: cex.caption n'est pas un paramètre graphique in: plot.window(xlim, H ylim, log, asp, ...) then your version of R must be severely outdated. cex.caption was newly introduced for R 2.6.1; current R is R 2.9.0. == Upgrade your R! H In my R help, I noticed the cex.caption doesn't appear compared to the help H I found online. [ . ] H Do you have a solution? yes, see above. H Thank you very much you're welcome. Martin Maechler, ETH Zurich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
Tena Sakai tsakai at gallo.ucsf.edu writes: I learned 3 new tricks. (Not bad for a newbie?) $ R --silent --no-save barebone.R $ R --quiet --no-save barebone.R $ R --slave barebone.R And don't forget R --vanilla which I like most because of the taste. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] truehist and density plots
carol white wrote: Hi, I wanted to plot the histogram of a vector and then, plot the density function of subsets of the vector on the histogram. So I use truehist in MASS package and lines(density) as follows: length(b) = 1000 truehist(b) lines(density(b[1:100])) however the density plot of the first 100 points exceeds the max of y axis (see attached). how is it possible to make a graphics so that the density plot of the subsets doesn't go beyond the maximum of all points in the complete set? Hi Carol, You can use the rescale function in the plotrix package to do things like this. Have a look at the example on the help page: # scale one vector into the range of another normal.counts-rnorm(100) normal.tab-tabulate(cut(normal.counts,breaks=seq(-3,3,by=1))) normal.density-rescale(dnorm(seq(-3,3,length=100)),range(normal.tab)) # now plot them plot(c(-2.5,-1.5,-0.5,0.5,1.5,2.5),normal.tab,xlab=X values, type=h,col=green) lines(seq(-3,3,length=100),normal.density,col=blue) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] colored PCA biplot
Hillary Cooper a écrit : Hi- I'm trying to make my PCA (princomp) colored. In my csv excel sheet, I have the first column numbered according to the groupings I want to assign to the PCA. I've played around with trying to set this first column as the color vector, but haven't had any luck. Any suggestions? Thanks, Hillary Hellor Hillary, Here is some modifications of my own DIY code, the thing to do is to test it and compare with the original biplot and with what you want. I hope it helps Etienne #my.data is your/my data # I create some groups just for the test groups = sample(1:3,N,replace=TRUE) N = nrow(my.data) acp=princomp(my.data,cor=TRUE) # The original biplot for comparison biplot(acp) # Compute de min/max of new coordinates xmin = min(acp$scores[,1]) xmax = max(acp$scores[,1]) ymin = min(acp$scores[,2]) ymax = max(acp$scores[,2]) plot(c(xmin,xmax),c(ymin,ymax),col=white, xlab=Comp 1, ylab=Comp 2) # Plot the points with colors text(acp$scores[,1],acp$scores[,2],1:N,col= groups) title(PCA with colors) abline(v=0,lty=2) abline(h=0, lty=2) # Compute and apply a re-scaling for the arrows of old components # xl.min for min of xloadings,... xl.min = min(0,min(acp$loadings[,1])) xl.max = max(0,max(acp$loadings[,1])) yl.min = min(0,min(acp$loadings[,2])) yl.max = max(0,max(acp$loadings[,2])) xl.scale = max(abs(xmax),abs(xmin))/max(abs(xl.max),abs(xl.min))*0.75 # 0.75 factor is just for leave some place for the text yl.scale = max(abs(ymax),abs(ymin))/max(abs(yl.max),abs(yl.min))*0.75 #Draw old components arrows(rep(0,100),rep(0,100),acp$loadings[,1]*xl.scale, acp$loadings[,2]*yl.scale) # Names of old components text(acp$loadings[,1]*xl.scale*1.25, acp$loadings[,2]*yl.scale*1.25 ,colnames(my.data)) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
Wacek Kusnierczyk wrote: Dieter Menne wrote: R --vanilla which I like most because of the taste. once we talk about preferences, here's the version which i like most because of (a) least typing, (b) the non-pompous little r: ... and (c) superior performance (in this particular case): r cat('foo\n') # foo time (R --silent --no-save cat('foo\n')) # 0.296s time (R --quiet --no-save cat('foo\n')) # 0.280s time (R --slave cat('foo\n')) # 0.293s time (r cat('foo\n')) # 0.055s vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
Dieter Menne wrote: Tena Sakai tsakai at gallo.ucsf.edu writes: I learned 3 new tricks. (Not bad for a newbie?) $ R --silent --no-save barebone.R $ R --quiet --no-save barebone.R $ R --slave barebone.R And don't forget R --vanilla which I like most because of the taste. once we talk about preferences, here's the version which i like most because of (a) least typing, (b) the non-pompous little r: r cat('foo\n') # foo vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] correlation coefficient
Bert Gunter gunter.berton at gene.com writes: Martin's reply provides an appropriate response, so nothing to add. But my questions dig deeper: Why do so many (presumably nonstatisticians, but ?) belong to this R^2 religion? Is it because: 1) This is what they are taught in their Stat 101 courses by statisticians? 2) ... by pseudostatisticians in their own professions (no disrespect intended here -- just want to make a clear distinction)? 3) It's the prevailing culture of their discipline (journal requirements, part of their standard texts, etc.)? Good point. Speaking from a clinical perspective: It is because many journals (British are the exception) ask medical reviewers to do the statistical reviewing within 5 minutes. They use the following formula to assess the quality of the paper (weights may vary): q(paper) = 10* n(pvalues) + 5*n(R^2) + 3.5*n(Error Bars) Values above 300 qualify for immediate acceptance, and Journals like Lancet, New English and British Journal of XXX provide professional advice. The first two are well known, the last is my special combat area. Glucose values measured every 2 minutes look like lice-comb, and nobody cares about the meaning. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with symbol function
Based on your solution, could we not fix this issue for the symbol function? Le 27 avr. 09 à 23:47, Duncan Murdoch a écrit : On 27/04/2009 5:23 PM, Christophe Dutang wrote: so it could be a limitation of graphics on windows? It's not graphics on Windows, but it appears to be a limitation of the windows() graphics device in R. It is used for bitmap plots as well as on-screen plots, which is why you saw the same effect in jpeg, but different devices are used for Postscript and PDF. When drawing lines, R handles the dash style itself, rather than using the built-in dashes. But it doesn't do so for circles, and doesn't make use of the Windows line styles. If you really need the dashes onscreen, you can draw the circle yourself. Assuming the scales are equal on both axes that's easy, just use theta - seq(0,2*pi, len=256) lines(x+r*cos(theta), y+r*sin(theta), lty=dashed) (where (x,y) is the center and r is the radius). It's more work if you want things to appear as circles when the scales are unequal, but I think this works: circle - function(x, y, inches=1, ...) { theta - seq(0, 2*pi, len=256) lines(x + grconvertX(inches*cos(theta), inches, user) - grconvertX(0, inches, user), y + grconvertY(inches*sin(theta), inches, user) - grconvertY(0, inches, user), ...) } so you'd get the plot you wanted using circle(0, 0, inches = 1.5, fg=black,lty=dashed) The circle function is not vectorized, so it's not as useful as symbols, but it could be improved. Duncan Murdoch It also appears with long dash lines. x - -4:4 y - -4:4 plot(x,y,type=n) symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg=black, lty=solid) symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg=black,lty=dashed) symbols(0, 0, add = TRUE, circles = 1, inches = 3, fg=black,lty=longdash, lwd=2) Le 27 avr. 09 à 23:07, Joshua Wiley a écrit : I read that the lty=2 argument does not work on all graphics devices. You might double check that since it works on mac. Joshua Wiley Original message Date: Mon, 27 Apr 2009 22:58:11 +0200 From: Christophe Dutang duta...@gmail.com Subject: Re: [R] problem with symbol function To: Joshua Wiley jwile...@ucr.edu Cc: r-help@r-project.org This point is ok if I download R from the Austrian mirror. R is properly install on both computers. I also get this strange behavior with R 2.7.2. There is something I'm missing... Le 27 avr. 09 à 22:54, Joshua Wiley a écrit : I am running SP3. You said earlier that you were having trouble downloading 2.9.0, are you sure everything downloaded and installed properly? There have been some questions about transitioning to the new build going around. Joshua Wiley Original message Date: Mon, 27 Apr 2009 22:45:26 +0200 From: Christophe Dutang duta...@gmail.com Subject: Re: [R] problem with symbol function To: Joshua Wiley jwile...@ucr.edu Cc: r-help@r-project.org what is your service pack version? at home I use the SP2 version. Le 27 avr. 09 à 22:29, Joshua Wiley a écrit : Hi Christophe, I am able to plot dashed circles on Windows. I'm afraid I do not have any suggestions for you. What happens when you try to plot it on Windows? Joshua Wiley Original message Date: Mon, 27 Apr 2009 22:15:53 +0200 From: r-help-boun...@r-project.org (on behalf of Christophe Dutang duta...@gmail.com ) Subject: [R] problem with symbol function To: r-help@r-project.org Hi all, I use the symbol functions to draw circles. But the argument lty does not work on windows but works correctly on my macbook: x - -4:4 y - -4:4 plot(x,y,type=n) symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg=black, lty=solid) symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg=black, lty=dashed) The second circle should be drawn with dash... it works on my macbook but on my PC. I use R 2.9.0 on windows xp home and mac os 10.5. Does anyone have this problem? is it a limitation of windows? thanks in advance Christophe -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
Re: [R] Newbie R question PART2
Hi, That's pretty impressive performance, but wait. Where does this little r come from? And how does it differ from its big brother? Regards, Tena Sakai tsa...@gallo.ucsf.edu -Original Message- From: r-help-boun...@r-project.org on behalf of Wacek Kusnierczyk Sent: Wed 4/29/2009 12:49 AM To: Dieter Menne Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Newbie R question PART2 Wacek Kusnierczyk wrote: Dieter Menne wrote: R --vanilla which I like most because of the taste. once we talk about preferences, here's the version which i like most because of (a) least typing, (b) the non-pompous little r: ... and (c) superior performance (in this particular case): r cat('foo\n') # foo time (R --silent --no-save cat('foo\n')) # 0.296s time (R --quiet --no-save cat('foo\n')) # 0.280s time (R --slave cat('foo\n')) # 0.293s time (r cat('foo\n')) # 0.055s vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] send command to other program
Thanks! I have not used system before. May it works if command ist the call for the program, but how can I integrate the transfer of the file names (strings) from R to the program? Ranjan Maitra wrote: Does ?system help? Ranjan On Tue, 28 Apr 2009 13:00:28 -0700 (PDT) thoeb t.hoebin...@gmail.com wrote: Hello, does anybody know about how to send a command or a text line from R to another program? I have written a script in which several calculations are made and outputfiles (csv) are generated. Afterwards I open another program (Fortran) via shell.exec. This program asks for the names if the output files and it would be quite practically if it could just adopt the file names from the r script. Thank you in advance! - Tamara Hoebinger University of Vienna -- View this message in context: http://www.nabble.com/send-command-to-other-program-tp23284885p23284885.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Tamara Hoebinger University of Vienna -- View this message in context: http://www.nabble.com/send-command-to-other-program-tp23284885p23290927.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ANOVA in Randomized-complete blocks design
Hi, I am trying to do an analysis of variance for Randomized-complete blocks design. I have 4 treatments and 3 replication, without intraction.then I am going to use LSD test for comparison between medium values of treatments. I already did that in SAS, but I am not familiar with R very well. Dose anybody has this Code? Please help me. Kind regards, Alisa __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
Tena Sakai wrote: Hi, That's pretty impressive performance, but wait. Where does this little r come from? And how does it differ from its big brother? the little r comes from littler [1]. it doesn't claim to be larger than it is. [1] http://dirk.eddelbuettel.com/code/littler.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] selecting ith rows of a matrix
Hi all, If I have a huge matrix/ dataframe and I want to create a new matrix/ dataframe with every second (or third, or fourth etc.) row of the original matrix, how can I do it? Any help much appreciated. Thanks, Umesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] selecting ith rows of a matrix
Try this, a = matrix(rnorm(10*10),ncol=10) a[, seq(1,ncol(a),by=2)] baptiste On 29 Apr 2009, at 09:28, Umesh Srinivasan wrote: Hi all, If I have a huge matrix/ dataframe and I want to create a new matrix/ dataframe with every second (or third, or fourth etc.) row of the original matrix, how can I do it? Any help much appreciated. Thanks, Umesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. _ Baptiste Auguié School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Cannot update.packages (error message)
Richardson, Patrick wrote: Uwe, I deleted gregmisc from by library folder and ran update.packages() again and I still get the same error: package 'fBasics' successfully unpacked and MD5 sums checked Error in unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) : malformed bundle DESCRIPTION file, no Contains field I am lost where this comes from. So, can you then please grep through all DESCRIPTION files in your library for bundle and tell me in which DESCRIPTION files this is present. Or even better: Can you try to debug yourself from which DESCRIPTION file it comes from? I'd set options(error=recover) and then go into the unpackPkg environment and check the actual objects therein. Thank you and best wishes, uwe Best regards, Patrick -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: Tuesday, April 28, 2009 11:01 AM To: Richardson, Patrick Cc: r-help@r-project.org Subject: Re: [R] Cannot update.packages (error message) Richardson, Patrick wrote: Hi Uwe, I was able to reinstall every package you suggested except for gregmisc (see below) package 'gregmisc' successfully unpacked and MD5 sums checked Error in unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) : malformed bundle DESCRIPTION file, no Contains field I've again tried update.packages() and the ones that fail are: fBasics Matrix plm R2HTML timeSeries zoo When trying to install the above packages I receive the same error are originally reported (same as in gregmisc). Any ideas? Arrrgh, I made anoter mistake with gregmisc which is now fixed. Can you try in 24 hours to reinstall gregmisc and try update.packages() after that? Or for even better for now: Please delete the gregmisc folder in your library and try to run update.packages after that. Still problems? Uwe Thanks, Patrick -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: Tuesday, April 28, 2009 10:01 AM To: Richardson, Patrick Cc: r-help@r-project.org Subject: Re: [R] Cannot update.packages (error message) Richardson, Patrick wrote: When trying to update (various) packages using update.packages() I get the following error message for various packages package 'fBasics' successfully unpacked and MD5 sums checked Error in unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) : malformed bundle DESCRIPTION file, no Contains field Can you try to reinstall (with install.packages()) all your installed package *bundles* (the 8 on CRAN are VR, CoCo, dse, hoa, gregmisc, BACCO, empiricalBayes, forecasting). I hope update packages will work again afterwards. Best wishes, Uwe Ligges This happens with other packages besides fBasics (Matrix, as well as others) and I have switched mirrors and the same thing occurs. Any suggestions? Best regards, Patrick Win XP SP3 R version 2.9.0 (2009-04-17) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] svSocket_0.9-5 TinnR_1.0.3R2HTML_1.59-1 Hmisc_3.5-2 loaded via a namespace (and not attached): [1] cluster_1.11.13 grid_2.9.0 lattice_0.17-22 svMisc_0.9-5tools_2.9.0 This email message, including any attachments, is for th...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient(s) please contact the sender by reply email and destroy all copies of the original message. Thank you. This email message, including any attachments, is for ...{{dropped:2}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] selecting ith rows of a matrix
probably you want to use seq(), e.g., mat - matrix(1:500, 100, 5) mat[seq(1, nrow(mat), 2), ] mat[seq(1, nrow(mat), 3), ] mat[seq(1, nrow(mat), 4), ] I hope it helps. Best, Dimitris Umesh Srinivasan wrote: Hi all, If I have a huge matrix/ dataframe and I want to create a new matrix/ dataframe with every second (or third, or fourth etc.) row of the original matrix, how can I do it? Any help much appreciated. Thanks, Umesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] selecting ith rows of a matrix
Thanks a lot Baptiste Dimitris, It's working! Cheers, Umesh On Wed, Apr 29, 2009 at 2:06 PM, Dimitris Rizopoulos d.rizopou...@erasmusmc.nl wrote: probably you want to use seq(), e.g., mat - matrix(1:500, 100, 5) mat[seq(1, nrow(mat), 2), ] mat[seq(1, nrow(mat), 3), ] mat[seq(1, nrow(mat), 4), ] I hope it helps. Best, Dimitris Umesh Srinivasan wrote: Hi all, If I have a huge matrix/ dataframe and I want to create a new matrix/ dataframe with every second (or third, or fourth etc.) row of the original matrix, how can I do it? Any help much appreciated. Thanks, Umesh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] plot.lm cex.caption
Thank you very much again. Now I just need to find out how to update R on Ubuntu with only aptitude available. haha! Martin Maechler-4 wrote: H == HighSchool2005 gemeaux...@yahoo.fr on Tue, 28 Apr 2009 06:29:07 -0700 (PDT) writes: H Hello dear R users, H My objective is to change the size of this graphic : plot(lm(a~b), 4) H (Cook's distance) H I have found the help on the internet saying to change the size of a title H on a graphic plot(lm(a ~ b), 4), I should use the graphic parameter H cex.caption H http://stat.ethz.ch/R-manual/R-patched/library/stats/html/plot.lm.html H But in my install of R, it answers cex.caption isn't a graphic parameter : H 5: cex.caption n'est pas un paramètre graphique in: plot.window(xlim, H ylim, log, asp, ...) then your version of R must be severely outdated. cex.caption was newly introduced for R 2.6.1; current R is R 2.9.0. == Upgrade your R! H In my R help, I noticed the cex.caption doesn't appear compared to the help H I found online. [ . ] H Do you have a solution? yes, see above. H Thank you very much you're welcome. Martin Maechler, ETH Zurich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/plot.lm-cex.caption-tp23277200p23292749.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 me about data.frame
Hi. I have some problem so, I want you to help me. I have to classify some data, and show the result as plot diagram to my boss. I decide to use plsr function in pls package to analysis that. My data are some similar oliveoli data in that package. so, I make my data to similar data.frame of oliveoil data. But, My data are not operated by function, because, My data has not same data frame of oliveoil data. How can I make my data to same data frame of that. the output of oliveoil - oliveoil chemical.Acidity chemical.Peroxide chemical.K232 chemical.K270 chemical.DK sensory.yellow sensory.green G1 0.73 12.7 1.9 0.139 0.003 21.4 73.4 G2 0.19 12.3 1.678 0.116 -0.004 23.4 66.3 G3 0.26 10.3 1.629 0.116 -0.005 32.7 53.5 G4 0.67 13.7 1.701 0.168 -0.002 30.2 58.3 G5 0.52 11.2 1.539 0.119 -0.001 51.8 32.5 I1 0.26 18.7 2.117 0.142 0.001 40.7 42.9 I2 0.24 15.3 1.891 0.116 0 53.8 30.4 I3 0.3 18.5 1.908 0.125 0.001 26.4 66.5 I4 0.35 15.6 1.824 0.104 0 65.7 12.1 I5 0.19 19.4 2.222 0.158 -0.003 45 31.9 S1 0.15 10.5 1.522 0.116 -0.004 70.9 12.2 S2 0.16 8.14 1.5270.1063 -0.002 73.5 9.7 S3 0.27 12.5 1.555 0.093 -0.002 68.112 S4 0.1611 1.573 0.094 -0.003 67.6 13.9 S5 0.24 10.8 1.331 0.085 -0.003 71.4 10.6 S6 0.3 11.4 1.415 0.093 -0.004 71.410 sensory.brown sensory.glossy sensory.transp sensory.syrup G1 10.1 79.7 75.2 50.3 G2 9.8 77.8 68.7 51.7 G3 8.7 82.3 83.2 45.4 G4 12.2 81.1 77.1 47.8 G5 8 72.4 65.3 46.5 I1 20.1 67.7 63.5 52.2 I2 11.5 77.8 77.3 45.2 I3 14.2 78.7 74.6 51.8 I4 10.3 81.6 79.6 48.3 I5 28.4 75.7 72.9 52.8 S1 10.8 87.7 88.1 44.5 S2 8.3 89.9 89.7 42.3 S3 10.8 78.4 75.1 46.4 S4 11.9 84.6 83.8 48.5 S5 10.8 88.1 88.5 46.7 S6 11.4 89.5 88.5 47.2 colnames(oliveoil) [1] chemical sensory --- test_mtx sp.a sp.b sp.c mw.0.1 mw.0.2 mw.0.3 mw.0.4 1100123123123123 2100134134134134 3010456456456456 4010475475475475 5001689689689689 6001789789789789 colnames(test_mtx) [1] sp.a sp.b sp.c mw.0.1 mw.0.2 mw.0.3 mw.0.4 I want to show figure in down side. - test_mtx sp.a sp.b sp.c mw.0.1 mw.0.2 mw.0.3 mw.0.4 1100123123123123 2100134134134134 3010456456456456 4010475475475475 5001689689689689 6001789789789789 colnames(test_mtx) [1] sp,mw 짹횞쨈챘�횉 쨩챤쩔징 횉횪쨘쨔�횑 짹챗쨉챕짹창쨍짝... [1][wVpvTe.LSMSRNyWa4ML8cw00] [횉횗쨍횧�횕 Express][2]쨍횧�횕쨍챰쨌횕째첬 쨔횑쨍짰쨘쨍짹창쨍짝 쨉쩔쩍횄쩔징! [3]쨔횑쩐횈횄짙짹창
Re: [R] The .tex version of the manual in foo.Rcheck
Bendix, you can also take a source package an run R CMD Rd2dvi --no-clean packageName on it and you will get a temporary directory with the TeX sources in it. Best wishes, Uwe BXC (Bendix Carstensen) wrote: In version 2.8.1, running Rcmd check on the package foo would leave the file foo-manual.tex in the folder foo.Rcheck. But as of 2.9.0 only foo-manual.pdf and foo-manual.log are there. Is this intentional? Anyway it is inconvenient, because I would occasionally like to include the manual at the end of a set of exercises, and this was a convenient file to \input with a few select %'s added. br. Bendix ___ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) b...@steno.dk http://www.biostat.ku.dk/~bxc www.steno.dk This e-mail (including any attachments) is intended for ...{{dropped:8}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] estimate alpha beta for gamma
Hi R-users, I'm not sure what's wrong and how do I check the error? I have 3 sets of data aug_dt1 [1] 22.8 49.6 77.9 67.6 91.2 48.9 124.6 54.6 85.8 62.8 63.3 174.7 32.3 22.7 99.9 123.2 4.8 149.0 66.0 [20] 73.9 37.4 22.4 69.5 87.3 66.9 87.2 81.5 109.1 47.4 22.8 92.4 60.9 77.5 91.3 91.9 78.2 39.4 107.5 [39] 57.9 65.5 76.0 47.2 145.5 95.9 106.0 120.4 108.0 96.8 30.2 16.6 54.0 91.0 63.0 120.6 10.0 144.2 126.4 [58] 160.6 dec_dt1 [1] 3.3 44.2 157.5 1.0 22.1 179.7 42.0 37.1 184.2 31.5 1.5 3.8 54.7 19.3 19.9 0.5 45.5 15.8 42.7 [20] 104.7 52.6 15.4 67.4 21.7 66.5 11.8 124.4 39.3 17.3 77.5 11.4 18.0 68.2 77.0 41.3 16.3 61.6 24.6 [39] 197.3 4.6 62.1 24.4 37.9 97.7 1.3 69.8 13.9 98.4 30.6 8.6 43.4 1.0 102.0 35.0 21.8 55.4 18.2 [58] 67.6 jan_dt1 [1] 49.7 21.8 5.6 24.2 0.8 32.0 88.9 61.6 36.8 74.0 16.3 2.6 7.6 149.7 13.0 65.2 3.8 72.1 49.0 [20] 3.8 24.1 4.3 19.6 32.3 5.6 54.6 94.2 40.7 101.3 0.5 11.7 9.9 86.4 24.3 91.3 66.5 13.2 0.8 [39] 16.0 24.7 18.1 13.5 126.5 18.1 62.5 98.9 212.6 19.2 42.4 41.6 73.2 8.6 15.0 43.2 43.0 1.4 167.4 [58] 11.4 This is my code to estimate alpha and beta: library(MASS) alpha.beta - function(dt) { tol - 1E-6 fit - list() x - dt a - x [x tol] fit - fitdistr(a,dgamma, list(shape = 1, rate = 0.01), lower = 0.01) fit } When I run I got this message: alpha.beta(dec_dt1) Error in fitdistr(a, dgamma, list(shape = 1, rate = 0.01), lower = 0.01) : optimization failed alpha.beta(aug_dt1) Error in fitdistr(a, dgamma, list(shape = 1, rate = 0.01), lower = 0.01) : optimization failed but it works for january data alpha.beta(jan_dt1) shape rate 0.89517560 0.02063325 (0.14460597) (0.00437990) Thank you so much for any help given. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RweaveHTML (R2HTML) Help
Hello Derek, Unfortunately, I can't help you with R2HTML. But if you want to generate html output of R commands, you could also try ascii package http://eusebe.github.com/ascii/ (available on CRAN). Here an example file (example.Rnw, with asciidoc http://www.methods.co.nz/asciidocmarkup) : Example === :Author:Your Name :Email: n...@whatever.com = data(iris) summary(iris) @ Then, you can use RweaveAsciidoc driver : library(ascii) Le chargement a nécessité le package : proto Sweave(example.Rnw, RweaveAsciidoc) Writing to file example.txt Processing code chunks ... 1 : echo term verbatim You can now run asciidoc on 'example.txt' And then use asciidoc to generate your html file (see asciidoc homepagehttp://www.methods.co.nz/asciidocfor installation and use). asciidoc example.txt You'll find the html file produced in attachement. Best. david 2009/4/29 Derek Ogle do...@northland.edu I have found Sweave() to be great for producing PDF documents. I have been experimenting with RweaveHTML (from the R2HTML) package and have had moderate success. My main issue has been that I simply want the R output to be shown verbatim in the HTML document but RweaveHTML tends to convert most output to a table, for example. So, is there a way to force the RweaveHTML driver to simply provide the output of a function exactly as it would appear in the R console window? Thanks in advance for any help. A minimal reproducible example of my .rnw file is below ... html body pThis is an example/p = data(iris) summary(iris) @ /body /html which if I saved as test.rnw I would use ... library(R2HTML) sweave(test.rnw,driver=RweaveHTML()) ... which will produce test.html which looks like ... html link rel=stylesheet type=text/css href=R2HTML.cssbody pThis is an example/p !-- begin{Schunk} !-- !-- begin{Sinput} !-- pxmp class=command data(iris)/xmp/p pxmp class=command summary(iris)/xmp/p !-- end{Sinput} !-- p align= center table cellspacing=0 border=1caption align=bottom class=captiondataframe/captiontrtd table border=0 class=dataframe tbody tr class= firstline th/thth Sepal.Length/thth Sepal.Width/thth Petal.Length/thth Petal.Width/thth Species/th /tr trtd class=firstcolumn/tdtd class=cellinsideMin. :4.300 /tdtd class=cellinsideMin. :2.000 /tdtd class=cellinsideMin. :1.000 /tdtd class=cellinsideMin. :0.100 /tdtd class=cellinsidesetosa:50 /td/tr trtd class=firstcolumn/tdtd class=cellinside1st Qu.:5.100 /tdtd class=cellinside1st Qu.:2.800 /tdtd class=cellinside1st Qu.:1.600 /tdtd class=cellinside1st Qu.:0.300 /tdtd class=cellinsideversicolor:50 /td/tr trtd class=firstcolumn/tdtd class=cellinsideMedian :5.800 /tdtd class=cellinsideMedian :3.000 /tdtd class=cellinsideMedian :4.350 /tdtd class=cellinsideMedian :1.300 /tdtd class=cellinsidevirginica :50 /td/tr trtd class=firstcolumn/tdtd class=cellinsideMean :5.843 /tdtd class=cellinsideMean :3.057 /tdtd class=cellinsideMean :3.758 /tdtd class=cellinsideMean :1.199 /tdtd class=cellinsideNA /td/tr trtd class=firstcolumn/tdtd class=cellinside3rd Qu.:6.400 /tdtd class=cellinside3rd Qu.:3.300 /tdtd class=cellinside3rd Qu.:5.100 /tdtd class=cellinside3rd Qu.:1.800 /tdtd class=cellinsideNA /td/tr trtd class=firstcolumn/tdtd class=cellinsideMax. :7.900 /tdtd class=cellinsideMax. :4.400 /tdtd class=cellinsideMax. :6.900 /tdtd class=cellinsideMax. :2.500 /tdtd class=cellinsideNA /td/tr /tbody /table /td/table br !--\end{Schunk}!-- /body /html Session Info R version 2.8.0 (2008-10-20) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] pda_1.2-3 MASS_7.2-46lme4_0.999375-28 Matrix_0.999375-22 lattice_0.17-20car_1.2-12 NCStats_0.1-1 [8] sciplot_1.0-4 plotrix_2.5-4 nortest_1.0 svSocket_0.9-5 TinnR_1.0.2R2HTML_1.59Hmisc_3.5-2 loaded via a namespace (and not attached): [1] cluster_1.11.12 gdata_2.4.2 gplots_2.6.0 grid_2.8.0 gtools_2.5.0-1svMisc_0.9-5 TeachingDemos_2.3 tools_2.8.0 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Example Your Name [1]n...@whatever.com data(iris) summary(iris) Sepal.LengthSepal.Width Petal.Length
Re: [R] send command to other program
thoeb wrote: Hello, does anybody know about how to send a command or a text line from R to another program? I have written a script in which several calculations are made and outputfiles (csv) are generated. Afterwards I open another program (Fortran) via shell.exec. This program asks for the names if the output files and it would be quite practically if it could just adopt the file names from the r script. Hi Tamara, If the succeeding program can read the name of the input file via the command line arguments, like: myfortranprogram -i myfile.csv you can include the arguments in the shell call. Alternatively, you could have R write a shell script that would execute the program with the appropriate arguments, then call the shell script from R. Of course if your program has to have keyboard input for the filename, you would have to resort to magic like writing the filename into the keystroke buffer. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] send command to other program
Hi, Consider also that you may easily modify system names from inside your R script as: system(mv oldname newname) Best Regards, Javier ... thoeb wrote: Hello, does anybody know about how to send a command or a text line from R to another program? I have written a script in which several calculations are made and outputfiles (csv) are generated. Afterwards I open another program (Fortran) via shell.exec. This program asks for the names if the output files and it would be quite practically if it could just adopt the file names from the r script. Hi Tamara, If the succeeding program can read the name of the input file via the command line arguments, like: myfortranprogram -i myfile.csv you can include the arguments in the shell call. Alternatively, you could have R write a shell script that would execute the program with the appropriate arguments, then call the shell script from R. Of course if your program has to have keyboard input for the filename, you would have to resort to magic like writing the filename into the keystroke buffer. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] legend with small colored boxes
Hi all, I tried to a nice legend with small boxes filled with the colors used for the plots. But it does nor work, boxes are always filled with black. An example is here plot(1:4,1:4) lines(1:4,4:1, col=blue) legend(top,leg=c(a,b),col=c(black,blue), fill=TRUE) How could I specify the colors? the argument col.box is the color of the whole legend box... Thanks in advance Christophe PS : I work with R 2.9.0. -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] legend with small colored boxes
Christophe Dutang a écrit : Hi all, I tried to a nice legend with small boxes filled with the colors used for the plots. But it does nor work, boxes are always filled with black. An example is here plot(1:4,1:4) lines(1:4,4:1, col=blue) #try something like this legend(top,leg=c(a,b),fill=1:2) Etienne legend(top,leg=c(a,b),col=c(black,blue), fill=TRUE) How could I specify the colors? the argument col.box is the color of the whole legend box... Thanks in advance Christophe PS : I work with R 2.9.0. -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] send command to other program
Jim Lemon wrote: thoeb wrote: Hello, does anybody know about how to send a command or a text line from R to another program? I have written a script in which several calculations are made and outputfiles (csv) are generated. Afterwards I open another program (Fortran) via shell.exec. This program asks for the names if the output files and it would be quite practically if it could just adopt the file names from the r script. Hi Tamara, If the succeeding program can read the name of the input file via the command line arguments, like: myfortranprogram -i myfile.csv you can include the arguments in the shell call. Alternatively, you could have R write a shell script that would execute the program with the appropriate arguments, then call the shell script from R. Of course if your program has to have keyboard input for the filename, you would have to resort to magic like writing the filename into the keystroke buffer. if your r code produces just the file names, each on a separate line, and the other program takes file names from the args list with no particular option needed to specify them, you might try: r your r script | xargs your program your program $(r your r script) as in # dummy files and scripts echo foo foo echo bar bar echo cat(paste(c('foo', 'bar'), '\n', collapse='')) script.r echo 'for f in $@; do echo input: $f; done' program chmod 755 program r script.r | xargs ./program ./program $(r script.r) you may need to adapt the pattern to a shell other than bash. vQ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] correlation coefficient
Dieter Menne wrote: Bert Gunter gunter.berton at gene.com writes: Martin's reply provides an appropriate response, so nothing to add. But my questions dig deeper: Why do so many (presumably nonstatisticians, but ?) belong to this R^2 religion? Is it because: 1) This is what they are taught in their Stat 101 courses by statisticians? 2) ... by pseudostatisticians in their own professions (no disrespect intended here -- just want to make a clear distinction)? 3) It's the prevailing culture of their discipline (journal requirements, part of their standard texts, etc.)? Good point. Speaking from a clinical perspective: It is because many journals (British are the exception) ask medical reviewers to do the statistical reviewing within 5 minutes. They use the following formula to assess the quality of the paper (weights may vary): q(paper) = 10* n(pvalues) + 5*n(R^2) + 3.5*n(Error Bars) Values above 300 qualify for immediate acceptance, and Journals like Lancet, New English and British Journal of XXX provide professional advice. The first two are well known, the last is my special combat area. Glucose values measured every 2 minutes look like lice-comb, and nobody cares about the meaning. Dieter A very good reply, and the quality formula is probably too close to the truth to be funny. Some of the answers given to the people who petition the list for help seem to loftily ignore the fact that the petitioners are more concerned with getting their paper accepted or their salary paid or their dinner cooked than with the opinions of those not so motivated about the existential significance of R^2. They may, like your humble correspondent, be well aware of the failings of R^2, but be unable to conduct a just and noble campaign against the editor, boss or chef who demands it. I have just returned from a meeting in which the chief investigator was demanding more user friendliness, despite the fact that this clever marketing ploy had turned much of her previous data to random numbers. I dunno, it beats me. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] legend with small colored boxes
Christophe Dutang wrote: Hi all, I tried to a nice legend with small boxes filled with the colors used for the plots. But it does nor work, boxes are always filled with black. An example is here plot(1:4,1:4) lines(1:4,4:1, col=blue) legend(top,leg=c(a,b),col=c(black,blue), fill=TRUE) How could I specify the colors? the argument col.box is the color of the whole legend box... Ah Cristophe, you have been waylaid by the coercion of types. The fill argument specifies the colors of the boxes, and you have sent it TRUE. As TRUE happens to be equal to 1, legend is fooled into filling the boxes with the color assigned the number 1, which is black. Try: legend(...,fill=c(black,blue),...) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : legend with small colored boxes
Hi Christophe, just try : legend(top,leg=c(a,b),fill=c(black,blue)) instead of your : legend(top,leg=c(a,b),col=c(black,blue), fill=TRUE) Regards, Olivier -- Olivier ETERRADOSSI Maître-Assistant CMGD / Equipe Propriétés Psycho-Sensorielles des Matériaux Ecole des Mines d'Alès Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9 tel std: +33 (0)5.59.30.54.25 tel direct: +33 (0)5.59.30.90.35 fax: +33 (0)5.59.30.63.68 http://www.ema.fr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] correlation coefficient
Dieter Menne dieter.menne at menne-biomed.de writes: q(paper) = 10* n(pvalues) + 5*n(R^2) + 3.5*n(Error Bars) Values above 300 qualify for immediate acceptance, and Journals like Lancet, New English and British Journal of XXX provide professional advice. I noted the and was misleading. Read: Good journals like Lancet, New English and many British Journal of XXX really help you to do better. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] reading csv file : blanks
Hi, I have a comma seperated data file which has blanks in it. I am trinying to import it to R using data1-read.csv(oa_2006.csv, header = TRUE, sep = ,, quote=\, dec=.) I want the missing values to be NA. instead R reads them as U. Any idea why this happens ? Thanks in advance. Regards, Nataraju GM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] selecting ith rows of a matrix
On Wed, Apr 29, 2009 at 01:58:06PM +0530, Umesh Srinivasan wrote: Hi all, If I have a huge matrix/ dataframe and I want to create a new matrix/ dataframe with every second (or third, or fourth etc.) row of the original matrix, how can I do it? Any help much appreciated. Others ahve already poitned out soltions using seq9(). I'd just like to add an alternative approach making use of R's logical indexing and recycling rules: mat - matrix(1:1000, 100, 5) mat2 - mat[c(T,F),] cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://mips.gsf.de/staff/pagel __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] combine_factor to empty level
ID: T8dfe471e360ac80264c6c Dear, I'm using R 2.8.1 with the package reshape version 0.8.2 . It seems that the combine_factor function has problems with combining levels to an empty level: #EXAMPLE WORKING test-sample(c(1:10),1000,replace=T) testf-factor(test, c(1:10), LETTERS[1:10]) table(testf,exclude=NULL) testc-combine_factor(testf, c(1,1,1,1,1,2,2,2,2,2)) levels(testc)-c(A-E,F-J) table(testc,exclude=NULL) #EXAMPLE NOT WORKING test-sample(c(1:5),1000,replace=T) testf-factor(test, c(1:10), LETTERS[1:10]) table(testf,exclude=NULL) testc-combine_factor(testf, c(1,1,1,1,1,2,2,2,2,2)) #Error in factor(variable[as.numeric(fac)], labels = levels(fac)[!duplicated(variable)]) : # invalid labels; length 2 should be 1 or 1 #EXAMPLE WORKING testc-combine_factor(testf, c(1,2,1,2,1,2,1,2,1,2)) levels(testc)-c(A/C/E/G/I,B/D/F/H/J) table(testc,exclude=NULL) How can I solve the problem? Robbie robbie.heremans.4...@police.be ** The Belgian Police in no way guarantees the technical integrity of the content of this message, nor the identity of the sender. If you received this message by mistake, any disclosure, reproduction, copying, distribution, or other dissemination or use of this communication is strictly prohibited. In this case please notify the sender immediately and then delete this message. *** De Belgische Politie kan noch de technische integriteit van de inhoud van dit bericht, noch de identiteit van de afzender garanderen. Als u dit bericht per vergissing ontvangen hebt, dan is elke bekendmaking, reproductie, vorm van copiëren, verdeling of andere verspreiding of gebruik van deze communicatie strikt verboden. Gelieve in dit geval de afzender onmiddellijk te verwittigen en het bericht de verwijderen. *** La Police Belge ne peut garantir ni l'intégrité technique du contenu de ce message, ni l'identité de l'expéditeur. Si, par erreur, vous recevez ce message, toute annonce du contenu, reproduction, copie, distribution ou autre diffusion ou usage de cette communication est strictement interdit. Veuillez dans ce cas avertir immédiatement l'expéditeur et effacer ce message. *** __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to word-wrap text in labels in plots?
c - structure(c(2L, 2L, 1L, 3L, 4L, 2L, 3L, 2L, 3L, 2L, 5L), .Label = c(foo, + bar, a really really long variable label mostly here to show the need of word-wrapping text in labels, + a not so important value, baz), class = factor) plot(c) Is there a way to get the long variable labels to automatically wrap so that all labels can be shown? Alternatively, is there a way to get the labels truncated, possibly with .. appended? -- Hans Ekbrand (http://sociologi.cjb.net) h...@sociologi.cjb.net Q. What is that strange attachment in this mail? A. My digital signature, see www.gnupg.org for info on how you could use it to ensure that this mail is from me and has not been altered on the way to you. signature.asc Description: Digital signature __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] legend with small colored boxes
I thought I have tried to pass a vector of colors and that it did not work.. Thanks for all! Christophe Le 29 avr. 09 à 12:16, Jim Lemon a écrit : Christophe Dutang wrote: Hi all, I tried to a nice legend with small boxes filled with the colors used for the plots. But it does nor work, boxes are always filled with black. An example is here plot(1:4,1:4) lines(1:4,4:1, col=blue) legend(top,leg=c(a,b),col=c(black,blue), fill=TRUE) How could I specify the colors? the argument col.box is the color of the whole legend box... Ah Cristophe, you have been waylaid by the coercion of types. The fill argument specifies the colors of the boxes, and you have sent it TRUE. As TRUE happens to be equal to 1, legend is fooled into filling the boxes with the color assigned the number 1, which is black. Try: legend(...,fill=c(black,blue),...) Jim -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with symbol function
Christophe Dutang wrote: Based on your solution, could we not fix this issue for the symbol function? Sure, send a patch. Duncan Murdoch Le 27 avr. 09 à 23:47, Duncan Murdoch a écrit : On 27/04/2009 5:23 PM, Christophe Dutang wrote: so it could be a limitation of graphics on windows? It's not graphics on Windows, but it appears to be a limitation of the windows() graphics device in R. It is used for bitmap plots as well as on-screen plots, which is why you saw the same effect in jpeg, but different devices are used for Postscript and PDF. When drawing lines, R handles the dash style itself, rather than using the built-in dashes. But it doesn't do so for circles, and doesn't make use of the Windows line styles. If you really need the dashes onscreen, you can draw the circle yourself. Assuming the scales are equal on both axes that's easy, just use theta - seq(0,2*pi, len=256) lines(x+r*cos(theta), y+r*sin(theta), lty=dashed) (where (x,y) is the center and r is the radius). It's more work if you want things to appear as circles when the scales are unequal, but I think this works: circle - function(x, y, inches=1, ...) { theta - seq(0, 2*pi, len=256) lines(x + grconvertX(inches*cos(theta), inches, user) - grconvertX(0, inches, user), y + grconvertY(inches*sin(theta), inches, user) - grconvertY(0, inches, user), ...) } so you'd get the plot you wanted using circle(0, 0, inches = 1.5, fg=black,lty=dashed) The circle function is not vectorized, so it's not as useful as symbols, but it could be improved. Duncan Murdoch It also appears with long dash lines. x - -4:4 y - -4:4 plot(x,y,type=n) symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg=black, lty=solid) symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg=black,lty=dashed) symbols(0, 0, add = TRUE, circles = 1, inches = 3, fg=black,lty=longdash, lwd=2) Le 27 avr. 09 à 23:07, Joshua Wiley a écrit : I read that the lty=2 argument does not work on all graphics devices. You might double check that since it works on mac. Joshua Wiley Original message Date: Mon, 27 Apr 2009 22:58:11 +0200 From: Christophe Dutang duta...@gmail.com Subject: Re: [R] problem with symbol function To: Joshua Wiley jwile...@ucr.edu Cc: r-help@r-project.org This point is ok if I download R from the Austrian mirror. R is properly install on both computers. I also get this strange behavior with R 2.7.2. There is something I'm missing... Le 27 avr. 09 à 22:54, Joshua Wiley a écrit : I am running SP3. You said earlier that you were having trouble downloading 2.9.0, are you sure everything downloaded and installed properly? There have been some questions about transitioning to the new build going around. Joshua Wiley Original message Date: Mon, 27 Apr 2009 22:45:26 +0200 From: Christophe Dutang duta...@gmail.com Subject: Re: [R] problem with symbol function To: Joshua Wiley jwile...@ucr.edu Cc: r-help@r-project.org what is your service pack version? at home I use the SP2 version. Le 27 avr. 09 à 22:29, Joshua Wiley a écrit : Hi Christophe, I am able to plot dashed circles on Windows. I'm afraid I do not have any suggestions for you. What happens when you try to plot it on Windows? Joshua Wiley Original message Date: Mon, 27 Apr 2009 22:15:53 +0200 From: r-help-boun...@r-project.org (on behalf of Christophe Dutang duta...@gmail.com ) Subject: [R] problem with symbol function To: r-help@r-project.org Hi all, I use the symbol functions to draw circles. But the argument lty does not work on windows but works correctly on my macbook: x - -4:4 y - -4:4 plot(x,y,type=n) symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg=black, lty=solid) symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg=black, lty=dashed) The second circle should be drawn with dash... it works on my macbook but on my PC. I use R 2.9.0 on windows xp home and mac os 10.5. Does anyone have this problem? is it a limitation of windows? thanks in advance Christophe -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr -- Christophe Dutang Ph. D. student at ISFA, Lyon, France website: http://dutangc.free.fr [[alternative
Re: [R] The .tex version of the manual in foo.Rcheck
G'day Uwe, On Wed, 29 Apr 2009 11:03:43 +0200 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: you can also take a source package an run R CMD Rd2dvi --no-clean packageName on it and you will get a temporary directory with the TeX sources in it. Which is fine for manual processing and when done once or twice, but somewhat less helpful for automatic processing in scripts since the name of the temporary directory is hard to predict. `R CMD check foo' copies already unconditionally the foo-manual.log file from the temporary directory to the foo.Rcheck directory; and the foo-manual.tex file is copied if an error occurs during processing. What is the problem with also copying the foo-manual.tex file unconditionally to foo.Rcheck? Cheers, Berwin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with survival
Terry Therneau wrote: It is likely a problem with survival, since 2.9 merged in a large number of changes that had occured in my source tree that had not propogated to the R tree my test suite doesn't have a test for this particular case (2 factors) and - Murphy's law applies: although almost every possible case is covered in the test suite, any new error will hit an omitted combination of options with high probability. I won't get to it for a few days though. As with other errors it will result in both a fix and an addition to the test suite. Thank you for a clear explanation of the problem. Terry T. Dieter Menne wrote: Make sure that this is really a problem with different versions of R, not a problem of different versions of survival which was changed recently, without backward compatibility, so that for example many function of Design (Harrell) do not work currently. The comment about backwards compatability is a little unfair. The code for survival curves post Cox model finally added the (long requested) ability to accomodate case weights. This added an argument to a C routine. The Design package called my C routine directly. I was not aware of this, there is no promise in any R package that the not-meant-to-be-called-by-others C routines won't change, Frank H was told about this as soon as we found out, and he's working on it. Exactly, and Thomas Dupont is modifying our code to take advantage of weights. Thanks Terry. -Frank __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 word-wrap text in labels in plots?
Hi Hans, strwrap is your friend. \n inserts a cr in a line of text. wordwrap-function(x,len) paste(strwrap(x,width=len),collapse=\n) par(mar=c(11,3,2,1)) tmp-plot(c,axes=F) axis(2) axis(1,at=tmp,labels=sapply(levels(c),wordwrap,len=15),padj=1) box() For unique abbreviations see ?abbreviate hth. Hans Ekbrand schrieb: c - structure(c(2L, 2L, 1L, 3L, 4L, 2L, 3L, 2L, 3L, 2L, 5L), .Label = c(foo, + bar, a really really long variable label mostly here to show the need of word-wrapping text in labels, + a not so important value, baz), class = factor) plot(c) Is there a way to get the long variable labels to automatically wrap so that all labels can be shown? Alternatively, is there a way to get the labels truncated, possibly with .. appended? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Eik Vettorazzi Institut für Medizinische Biometrie und Epidemiologie Universitätsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/42803-8243 F ++49/40/42803-7790 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 word-wrap text in labels in plots?
Hans Ekbrand wrote: c - structure(c(2L, 2L, 1L, 3L, 4L, 2L, 3L, 2L, 3L, 2L, 5L), .Label = c(foo, + bar, a really really long variable label mostly here to show the need of word-wrapping text in labels, + a not so important value, baz), class = factor) plot(c) Is there a way to get the long variable labels to automatically wrap so that all labels can be shown? Alternatively, is there a way to get the labels truncated, possibly with .. appended? As the first question has already been answered, you can truncate strings like this example from the htmlize function in the prettyR package: navitem-ifelse(nchar(Rcommand)20, paste(paste(unlist(strsplit(Rcommand,))[1:18],sep=,collapse=), ...,sep=,collapse=),Rcommand) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] reading csv file : blanks
Nattu wrote: Hi, I have a comma seperated data file which has blanks in it. I am trinying to import it to R using data1-read.csv(oa_2006.csv, header = TRUE, sep = ,, quote=\, dec=.) I want the missing values to be NA. instead R reads them as U. Any idea why this happens ? Hi Nataraju, You have to explicitly specify the strings that you want to be read as NA with the na.strings argument. na.strings= if an empty string represents NA. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] correlation coefficient
Dieter Menne dieter.me...@menne-biomed.de wrote I noted the and was misleading. Read: Good journals like Lancet, New English and many British Journal of XXX really help you to do better. I am one of the statistical editors for PLoS Medicine, and I try to help people do better; often, the people take my advice. Sometimes, they don't. I get good support from the editorial people there. Peter Peter L. Flom, PhD Statistical Consultant www DOT peterflomconsulting DOT com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
the little r comes from littler [1]. it doesn't claim to be larger than it is. [1] http://dirk.eddelbuettel.com/code/littler.html Unless you're working on a Mac or Windows (if I'm not mistaken about case handling there), where it will just overwrite the standard R interpreter. :-( Cheers, Just another former non-Mac-user. [ stefan.ev...@uos.de | http://purl.org/stefan.evert ] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
Hi Tena, I recommend rapache for building websites with R. See http://biostat.mc.vanderbilt.edu/rapache/ -Ista -- Forwarded message -- From: Tena Sakai tsa...@gallo.ucsf.edu To: ted.hard...@manchester.ac.uk, r-help@r-project.org Date: Tue, 28 Apr 2009 15:04:53 -0700 Subject: Re: [R] Newbie R question PART2 Hi, Many thanks to Wacek Kusnierczyk and Ted Harding. I learned 3 new tricks. (Not bad for a newbie?) $ R --silent --no-save barebone.R $ R --quiet --no-save barebone.R $ R --slave barebone.R With slight differences, they all do what I wanted. Moving right along my tiny agenda... Given the same one-liner, cat ('Hello World!\n') would someone please show me how to turn this one liner into a web page with Rpad? Obviously, What I want to build is a web page, where it say click here and when it is clicked the screen blanks out and give a line: Hello World! I have looked at an example or two of Rpad, but it was overly complicated for simpleminded newbie. Regards, Tena Sakai tsa...@gallo.ucsf.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Mailinglist; get a copy of all own messages
Hi, I tried to change my settings of the mailing-list, so that I get my own message again from the mailing-list. But it doesn't work - I don't get a copy of my own email. Does anyone know how you can change that? thanks for any help! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] modified Struve functions
Dear all, Is there an R package which calculates the modified Struve function (StruveL)? I was not able to find anything apt with a RSiteSearch so it does not appear to have been asked in the list. Many thanks and best wishes, Ranjan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Mailinglist; get a copy of all own messages
It's gmail, not the mailing list. Gmail stores your mailing list messages under Sent mail and I at least haven't found any way to convince it to filter them or store them elsewhere. If you reply to an earlier message, your reply should appear in the proper place, but there doesn't seem to be any way to automatically categorize new messages. Sarah On Wed, Apr 29, 2009 at 9:28 AM, Martin Batholdy batho...@googlemail.com wrote: Hi, I tried to change my settings of the mailing-list, so that I get my own message again from the mailing-list. But it doesn't work - I don't get a copy of my own email. Does anyone know how you can change that? -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] reading csv file : blanks
When you read in a .csv file with some empty cells using read.csv, there is no need to specify anything - empty cells will be recorded as NAs automatically: try: data1-read.csv(oa_2006.csv) Dimitri On Wed, Apr 29, 2009 at 7:54 AM, Jim Lemon j...@bitwrit.com.au wrote: Nattu wrote: Hi, I have a comma seperated data file which has blanks in it. I am trinying to import it to R using data1-read.csv(oa_2006.csv, header = TRUE, sep = ,, quote=\, dec=.) I want the missing values to be NA. instead R reads them as U. Any idea why this happens ? Hi Nataraju, You have to explicitly specify the strings that you want to be read as NA with the na.strings argument. na.strings= if an empty string represents NA. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski MarketTools, Inc. dimitri.liakhovit...@markettools.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] correlation coefficient
Just another opinion about R^2 coming from the field of US Psychology research and business: The first and foremost technique taught in Psychology Departments in subfields where experimental designs are rarely possible (i.e., social psychology, personality psychology, developmental psychology, Industrial/Organizational psychology) is multiple regression. You have some important response variable and a bunch of predictors. The goodness of fit of the model is assessed by looking at R^2. Hence, everyone has a feel for it and everyone wants to see it reported. Further, in business settings, most clients can understand a simple correlation. So, correlation squared is relatively easy to explain. Most of the corporate clients get nervous if you try to explain even a simple confusion table. Why? Because they have no internal benchmark for what's good fit and what's bad fit. With R^2 it's much easier. Dimitri On Wed, Apr 29, 2009 at 7:51 AM, Peter Flom peterflomconsult...@mindspring.com wrote: Dieter Menne dieter.me...@menne-biomed.de wrote I noted the and was misleading. Read: Good journals like Lancet, New English and many British Journal of XXX really help you to do better. I am one of the statistical editors for PLoS Medicine, and I try to help people do better; often, the people take my advice. Sometimes, they don't. I get good support from the editorial people there. Peter Peter L. Flom, PhD Statistical Consultant www DOT peterflomconsulting DOT com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski MarketTools, Inc. dimitri.liakhovit...@markettools.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] boxplot - margin settings
Hi there, I'm trying to solve a boxplot problem (should be simple, but I cannot find the solution...): data - list(long_name1_xxx = rnorm(100), long_name2_yy = rnorm(200)) boxplot(data , las = 2, mar = c(20,4,4,4)) Why does the margin not change whatever I put there??? With other plots it worked for me, why not in this case? I just want to see the whole label... I'm really sorry if I've missed a very obvious reason for this behaviour. Maybe someone can help me? Ciao, Antje __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 word-wrap text in labels in plots?
Thanks to Jim and Eik! I really appreciate your help, and I think can use your suggestions and perhaps write a wrapper for plot that integrates them. -- Hans Ekbrand (http://sociologi.cjb.net) h...@sociologi.cjb.net Q. What is that strange attachment in this mail? A. My digital signature, see www.gnupg.org for info on how you could use it to ensure that this mail is from me and has not been altered on the way to you. signature.asc Description: Digital signature __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 RExcel (running code)
Hello: First, RExcel completely rocks! Hat tip to the development team. However, I don't understand something very basic about it. Suppose I put the following code in two cells and choose the Run Code option plot(runif(20),runif(20)) text(.5,.5,Hello) I get the expected plot. HOWEVER, if I put the following in a cell and hit Run Code, I get nothing. runif(20) HOWEVER, If I choose the Get R Value command, and tell it to run runif(20), I get the output I expect. Am I doing something wrong, or just don't fully understand how the Run Code Option works? Actually, I don't get this at all- try the following in a cell cat(Hello) ERROR message when you try the Get R Value but the following works when you try the Get R Value print(Hello) Of course, neither of these commands work with the R Code option. Any insights from the gurus out there? Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] boxplot - margin settings
boxplot() isn't passing extra parameters in the way you'd expect. If you set par() first, it works fine. mar.orig - par()$mar # save the original values par(mar = c(20,4,4,4)) # set your new values boxplot(data, las = 2) par(mar = mar.orig) # put the original values back Sarah On Wed, Apr 29, 2009 at 10:06 AM, Antje niederlein-rs...@yahoo.de wrote: Hi there, I'm trying to solve a boxplot problem (should be simple, but I cannot find the solution...): data - list( long_name1_xxx = rnorm(100), long_name2_yy = rnorm(200)) boxplot(data , las = 2, mar = c(20,4,4,4)) Why does the margin not change whatever I put there??? With other plots it worked for me, why not in this case? I just want to see the whole label... I'm really sorry if I've missed a very obvious reason for this behaviour. Maybe someone can help me? Ciao, Antje -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if condition doesn't evaluate to True/False
Hi friends, Please help me with this bug. *Bug in my code:* In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where clause.every sub group has a where condition linked with it. Database1 Where clause was not found for a particular subgroup, sub_grp_whr_cls_data[sbgrp_no,1] value was NULL So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) should evaluate to TRUE ,but it evaluated to NA So the if block where I used the the condition threw error If(*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) i.e if(NA) Error:-- Error in if (sub_grp_whr_cls_data[sbgrp_no, 1] == NULL || sub_grp_whr_cls_data[sbgrp_no, : missing value where TRUE/FALSE needed Comments:-- but when there s no where clause value the condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) should automatically evaluate to * TRUE* Database2 Where clause was found for a particular subgroup The condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) evaluated to FALSE So if (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) is If (FALSE) ,control goes to the else part. This is exactly what is expected of the program. *QUERY:-- **If the condition evaluates to FALSE when a where condition is available why doesnt it evaluate to TRUE when a where condition available is NULL or no where condition is available.* Here I have taken the example of two databases where I tried to get the where clause for subgroup 1.In case of Database1 it was not available in case of Databse2 it was available.But the problem may appear for the same database also, when where clause is available for say one subgroup and not for the other. -- Thanks Moumita [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] boxplot - margin settings
I knew the solution would be kind of simple... Thanks a lot, Sarah! Sarah Goslee schrieb: boxplot() isn't passing extra parameters in the way you'd expect. If you set par() first, it works fine. mar.orig - par()$mar # save the original values par(mar = c(20,4,4,4)) # set your new values boxplot(data, las = 2) par(mar = mar.orig) # put the original values back Sarah On Wed, Apr 29, 2009 at 10:06 AM, Antje niederlein-rs...@yahoo.de wrote: Hi there, I'm trying to solve a boxplot problem (should be simple, but I cannot find the solution...): data - list( long_name1_xxx = rnorm(100), long_name2_yy = rnorm(200)) boxplot(data , las = 2, mar = c(20,4,4,4)) Why does the margin not change whatever I put there??? With other plots it worked for me, why not in this case? I just want to see the whole label... I'm really sorry if I've missed a very obvious reason for this behaviour. Maybe someone can help me? Ciao, Antje __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Mailinglist; get a copy of all own messages
Even if you have the mailing list options set so that you are sent copies of your own posts, gmail hides them for you. http://groups.google.com/group/Gmail-Help-Message-Delivery-en/browse_thread/thread/e7716ab04941c383?pli=1 It has nothing to do with the mailing list manager. The original querent has a google return address, so this is the most likely explanation. Unfortunately google claims this as a feature, and there doesn't seem to be a way around it. Sarah On Wed, Apr 29, 2009 at 10:23 AM, Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no wrote: Sarah Goslee wrote: It's gmail, not the mailing list. oops? it's a typical property of a mailing list manager that allows a subscriber to decide whether s/he want to receive copies of h{er,is} own posts. for r-help, you should be able to login at https://stat.ethz.ch/mailman/options/r-help where you've got a plethora of options, with Receive your own posts to the list? among them (haven't actually checked for r-help, but it's typical for mailman). vQ -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Kolmogorov-Smirnov test
I got a distribution function and a empirical distribution function. How do I make to Kolmogorov-Smirnov test in R. Lets call the empirical distribution function Fn on [0,1] and the distribution function F on [0,1] ks.test( ) thanks for the help -- View this message in context: http://www.nabble.com/Kolmogorov-Smirnov-test-tp23296096p23296096.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] The .tex version of the manual in foo.Rcheck
Berwin A Turlach wrote: G'day Uwe, On Wed, 29 Apr 2009 11:03:43 +0200 Uwe Ligges lig...@statistik.tu-dortmund.de wrote: you can also take a source package an run R CMD Rd2dvi --no-clean packageName on it and you will get a temporary directory with the TeX sources in it. Which is fine for manual processing and when done once or twice, but somewhat less helpful for automatic processing in scripts since the name of the temporary directory is hard to predict. `R CMD check foo' copies already unconditionally the foo-manual.log file from the temporary directory to the foo.Rcheck directory; and the foo-manual.tex file is copied if an error occurs during processing. What is the problem with also copying the foo-manual.tex file unconditionally to foo.Rcheck? No problem at all, I think. Uwe Cheers, Berwin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if condition doesn't evaluate to True/False
see ?is.null e.g. if( is.null(sub_grp_whr_cls_data[sbgrp_no, 1]) ) { your code } Moumita Das wrote: Hi friends, Please help me with this bug. *Bug in my code:* In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where clause.every sub group has a where condition linked with it. Database1 Where clause was not found for a particular subgroup, sub_grp_whr_cls_data[sbgrp_no,1] value was NULL So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) should evaluate to TRUE ,but it evaluated to NA So the if block where I used the the condition threw error If(*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) i.e if(NA) Error:-- Error in if (sub_grp_whr_cls_data[sbgrp_no, 1] == NULL || sub_grp_whr_cls_data[sbgrp_no, : missing value where TRUE/FALSE needed Comments:-- but when there ‘s no where clause value the condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) should automatically evaluate to * TRUE* Database2 Where clause was found for a particular subgroup The condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) evaluated to FALSE So if (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) is If (FALSE) ,control goes to the else part. This is exactly what is expected of the program. *QUERY:-- **If the condition evaluates to FALSE when a where condition is available why doesn’t it evaluate to TRUE when a where condition available is NULL or no where condition is available.* Here I have taken the example of two databases where I tried to get the where clause for subgroup 1.In case of Database1 it was not available in case of Databse2 it was available.But the problem may appear for the same database also, when where clause is available for say one subgroup and not for the other. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthias Burger Project Manager/ Biostatistician Epigenomics AGKleine Praesidentenstr. 110178 Berlin, Germany phone:+49-30-24345-0fax:+49-30-24345-555 http://www.epigenomics.com matthias.bur...@epigenomics.com -- Epigenomics AG Berlin Amtsgericht Charlottenburg HRB 75861 Vorstand: Geert Nygaard (CEO/Vorsitzender) Oliver Schacht PhD (CFO) Aufsichtsrat: Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Odp: if condition doesn't evaluate to True/False
Hi you put your problem in absolutely messy state r-help-boun...@r-project.org napsal dne 29.04.2009 16:16:55: Hi friends, Please help me with this bug. *Bug in my code:* In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where clause.every sub group has a where condition linked with it. Database1 Where clause was not found for a particular subgroup, sub_grp_whr_cls_data[sbgrp_no,1] value was NULL So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) should evaluate to TRUE ,but it evaluated to NA Are you sure that sub_grp_whr_cls_data[sbgrp_no,1] was either NULL or I suspect that it is NA you can get three results with logical values x-c(1,NULL, NA, , 1) x==NULL|x== [1] FALSE TRUENA TRUE FALSE So if the value is NULL or you will get TRUE, if it is anything else you will get FALSE but if it is NA you will get NA. Actually if the value is NA you do not know if it should be NULL, or anything else therefore result is NA Regards Petr So the if block where I used the the condition threw error If(*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) i.e if(NA) Error:-- Error in if (sub_grp_whr_cls_data[sbgrp_no, 1] == NULL || sub_grp_whr_cls_data[sbgrp_no, : missing value where TRUE/FALSE needed Comments:-- but when there ‘s no where clause value the condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) should automatically evaluate to * TRUE* Database2 Where clause was found for a particular subgroup The condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) evaluated to FALSE So if (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) is If (FALSE) ,control goes to the else part. This is exactly what is expected of the program. *QUERY:-- **If the condition evaluates to FALSE when a where condition is available why doesn’t it evaluate to TRUE when a where condition available is NULL or no where condition is available.* Here I have taken the example of two databases where I tried to get the where clause for subgroup 1.In case of Database1 it was not available in case of Databse2 it was available.But the problem may appear for the same database also, when where clause is available for say one subgroup and not for the other. -- Thanks Moumita [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Kolmogorov-Smirnov test
help.search(kolmogorov) ?ks.test andydol...@gmail.com 2009/4/29 mathallan mathanm...@gmail.com I got a distribution function and a empirical distribution function. How do I make to Kolmogorov-Smirnov test in R. Lets call the empirical distribution function Fn on [0,1] and the distribution function F on [0,1] ks.test( ) thanks for the help -- View this message in context: http://www.nabble.com/Kolmogorov-Smirnov-test-tp23296096p23296096.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Kolmogorov-Smirnov test
This is the third homework question you have asked the list to do for you. How many more should we expect? The posting guide is pretty clear in that: Basic statistics and classroom homework: R-help is not intended for these. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of mathallan Sent: Wednesday, April 29, 2009 10:52 AM To: r-help@r-project.org Subject: [R] Kolmogorov-Smirnov test I got a distribution function and a empirical distribution function. How do I make to Kolmogorov-Smirnov test in R. Lets call the empirical distribution function Fn on [0,1] and the distribution function F on [0,1] ks.test( ) thanks for the help -- View this message in context: http://www.nabble.com/Kolmogorov-Smirnov-test-tp23296096p23296096.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This email message, including any attachments, is for th...{{dropped:6}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if condition doesn't evaluate to True/False
Hi r-help-boun...@r-project.org napsal dne 29.04.2009 17:05:01: see ?is.null e.g. if( is.null(sub_grp_whr_cls_data[sbgrp_no, 1]) ) { your code } It probably will not work as sub_grp_whr_cls_data[sbgrp_no,1]==NULL implicates that there is character value NULL. I am not sure if you can get NULL as a part of some object. I tried and failed. See what you get x- c(1,2,3, NULL) Regards Petr Moumita Das wrote: Hi friends, Please help me with this bug. *Bug in my code:* In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where clause.every sub group has a where condition linked with it. Database1 Where clause was not found for a particular subgroup, sub_grp_whr_cls_data[sbgrp_no,1] value was NULL So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) should evaluate to TRUE ,but it evaluated to NA So the if block where I used the the condition threw error If(*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) i.e if(NA) Error:-- Error in if (sub_grp_whr_cls_data[sbgrp_no, 1] == NULL || sub_grp_whr_cls_data[sbgrp_no, : missing value where TRUE/FALSE needed Comments:-- but when there ‘s no where clause value the condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) should automatically evaluate to * TRUE* Database2 Where clause was found for a particular subgroup The condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) evaluated to FALSE So if (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) is If (FALSE) ,control goes to the else part. This is exactly what is expected of the program. *QUERY:-- **If the condition evaluates to FALSE when a where condition is available why doesn’t it evaluate to TRUE when a where condition available is NULL or no where condition is available.* Here I have taken the example of two databases where I tried to get the where clause for subgroup 1.In case of Database1 it was not available in case of Databse2 it was available.But the problem may appear for the same database also, when where clause is available for say one subgroup and not for the other. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthias Burger Project Manager/ Biostatistician Epigenomics AGKleine Praesidentenstr. 110178 Berlin, Germany phone:+49-30-24345-0fax:+49-30-24345-555 http://www.epigenomics.com matthias.bur...@epigenomics.com -- Epigenomics AG Berlin Amtsgericht Charlottenburg HRB 75861 Vorstand: Geert Nygaard (CEO/Vorsitzender) Oliver Schacht PhD (CFO) Aufsichtsrat: Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] what happens if a function removes an external (global) variable ?
My program consists of a number of functions and a main script. It loops through many time series analyzing one at a time. I have declared a number of arrays and scalar variables in the main script namespace (using C++ terminology) because those data structures ar shared by many functions. let say XX is he name of a global array. I wonder what happens in the following cases: 1. a function tries to remove the global array through the instruction rm(XX) Will the next usage of XX still access a global variable (if using the assignment operator -) or a new local one will be created ? 2. the main script removes the global array through the instruction rm(XX) Will the next usage of XX in the main script allocate a new global variable that can be accessed by all the called functions ? 3. If the global array XX is never removed but is assigned in different loops alternatively very short and very long time series then what will happen to the memory segment allocated to R ? Will it get more and more fragmented slowing down the process ... or aven crash ? Thank you very much. Maura tutti i telefonini TIM! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if condition doesn't evaluate to True/False
test - list(NULL) Bert Gunter Nonclinical Biostatistics 467-7374 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Petr PIKAL Sent: Wednesday, April 29, 2009 8:21 AM To: ml-r-h...@epigenomics.com Cc: r-h...@stat.math.ethz.ch; Moumita Das Subject: Re: [R] if condition doesn't evaluate to True/False Hi r-help-boun...@r-project.org napsal dne 29.04.2009 17:05:01: see ?is.null e.g. if( is.null(sub_grp_whr_cls_data[sbgrp_no, 1]) ) { your code } It probably will not work as sub_grp_whr_cls_data[sbgrp_no,1]==NULL implicates that there is character value NULL. I am not sure if you can get NULL as a part of some object. I tried and failed. See what you get x- c(1,2,3, NULL) Regards Petr Moumita Das wrote: Hi friends, Please help me with this bug. *Bug in my code:* In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where clause.every sub group has a where condition linked with it. Database1 Where clause was not found for a particular subgroup, sub_grp_whr_cls_data[sbgrp_no,1] value was NULL So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) should evaluate to TRUE ,but it evaluated to NA So the if block where I used the the condition threw error If(*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) i.e if(NA) Error:-- Error in if (sub_grp_whr_cls_data[sbgrp_no, 1] == NULL || sub_grp_whr_cls_data[sbgrp_no, : missing value where TRUE/FALSE needed Comments:-- but when there 's no where clause value the condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) should automatically evaluate to * TRUE* Database2 Where clause was found for a particular subgroup The condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) evaluated to FALSE So if (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) is If (FALSE) ,control goes to the else part. This is exactly what is expected of the program. *QUERY:-- **If the condition evaluates to FALSE when a where condition is available why doesn't it evaluate to TRUE when a where condition available is NULL or no where condition is available.* Here I have taken the example of two databases where I tried to get the where clause for subgroup 1.In case of Database1 it was not available in case of Databse2 it was available.But the problem may appear for the same database also, when where clause is available for say one subgroup and not for the other. -- -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthias Burger Project Manager/ Biostatistician Epigenomics AGKleine Praesidentenstr. 110178 Berlin, Germany phone:+49-30-24345-0fax:+49-30-24345-555 http://www.epigenomics.com matthias.bur...@epigenomics.com -- Epigenomics AG Berlin Amtsgericht Charlottenburg HRB 75861 Vorstand: Geert Nygaard (CEO/Vorsitzender) Oliver Schacht PhD (CFO) Aufsichtsrat: Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] if condition doesn't evaluate to True/False
Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 29.04.2009 17:05:01: see ?is.null e.g. if( is.null(sub_grp_whr_cls_data[sbgrp_no, 1]) ) { your code } It probably will not work as sub_grp_whr_cls_data[sbgrp_no,1]==NULL implicates that there is character value NULL. I am not sure if you can get NULL as a part of some object. I tried and failed. See what you get x- c(1,2,3, NULL) Regards Petr thanks for pointing this out clearly, I had thought only about making the comparison return a logical for use in the expression. On hindsight it seems implausible to ever get NULL in the matrix/data frame. (DONT USE playing around I found the following abuse to work m - as.data.frame(diag(3)) m[[3]][3] - list(NULL) is.null(m[3,3][[1]]) [1] TRUE ) Regards, Matthias Moumita Das wrote: Hi friends, Please help me with this bug. *Bug in my code:* In this variable sub_grp_whr_cls_data[sbgrp_no,1] I store the where clause.every sub group has a where condition linked with it. Database1 Where clause was not found for a particular subgroup, sub_grp_whr_cls_data[sbgrp_no,1] value was NULL So the condition (*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) should evaluate to TRUE ,but it evaluated to NA So the if block where I used the the condition threw error If(*sub_grp_whr_cls_data[sbgrp_no,1]==NULL || sub_grp_whr_cls_data[sbgrp_no,1]==*) i.e if(NA) Error:-- Error in if (sub_grp_whr_cls_data[sbgrp_no, 1] == NULL || sub_grp_whr_cls_data[sbgrp_no, : missing value where TRUE/FALSE needed Comments:-- but when there ‘s no where clause value the condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) should automatically evaluate to * TRUE* Database2 Where clause was found for a particular subgroup The condition (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) evaluated to FALSE So if (sub_grp_whr_cls_data[sbgrp_no,1]==NULL ||sub_grp_whr_cls_data[sbgrp_no,1]==) is If (FALSE) ,control goes to the else part. This is exactly what is expected of the program. *QUERY:-- **If the condition evaluates to FALSE when a where condition is available why doesn’t it evaluate to TRUE when a where condition available is NULL or no where condition is available.* Here I have taken the example of two databases where I tried to get the where clause for subgroup 1.In case of Database1 it was not available in case of Databse2 it was available.But the problem may appear for the same database also, when where clause is available for say one subgroup and not for the other. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthias Burger Project Manager/ Biostatistician Epigenomics AGKleine Praesidentenstr. 110178 Berlin, Germany phone:+49-30-24345-0fax:+49-30-24345-555 http://www.epigenomics.com matthias.bur...@epigenomics.com -- Epigenomics AG Berlin Amtsgericht Charlottenburg HRB 75861 Vorstand: Geert Nygaard (CEO/Vorsitzender) Oliver Schacht PhD (CFO) Aufsichtsrat: Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Matthias Burger Project Manager/ Biostatistician Epigenomics AGKleine Praesidentenstr. 110178 Berlin, Germany phone:+49-30-24345-0fax:+49-30-24345-555 http://www.epigenomics.com matthias.bur...@epigenomics.com -- Epigenomics AG Berlin Amtsgericht Charlottenburg HRB 75861 Vorstand: Geert Nygaard (CEO/Vorsitzender) Oliver Schacht PhD (CFO) Aufsichtsrat: Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained,
Re: [R] Newbie R question PART2
Tena Sakai wrote: Hi, Many thanks to Wacek Kusnierczyk and Ted Harding. I learned 3 new tricks. (Not bad for a newbie?) $ R --silent --no-save barebone.R $ R --quiet --no-save barebone.R $ R --slave barebone.R With slight differences, they all do what I wanted. Moving right along my tiny agenda... Given the same one-liner, cat ('Hello World!\n') would someone please show me how to turn this one liner into a web page with Rpad? For the basic 'put text in an html page' library(hwriter) htmlFile = tempfile() hwrite(Hello World, htmlFile) browseURL(htmlFile) for more advanced static pages example(hwrite) Martin Obviously, What I want to build is a web page, where it say click here and when it is clicked the screen blanks out and give a line: Hello World! I have looked at an example or two of Rpad, but it was overly complicated for simpleminded newbie. Regards, Tena Sakai tsa...@gallo.ucsf.edu -Original Message- From: ted.hard...@manchester.ac.uk [mailto:ted.hard...@manchester.ac.uk] Sent: Tue 4/28/2009 2:11 PM To: r-help@r-project.org Cc: Tena Sakai Subject: RE: [R] Newbie R question On 28-Apr-09 20:42:45, Tena Sakai wrote: Hi, I am a newbie with R. My environment is linux and I have a file. I call it barebone.R, which has one line: cat ('Hello World!\n') I execute this file as: R --no-save barebone.R And it does what I expect. What I get is 20+/- lines of text, one of which is 'Hello World!'. How would I go about getting rid of all but the line I am after, 'Hello World!'? Regards, Tena Sakai tsa...@gallo.ucsf.edu An unusual request! I had to browse 'man R' a bit before getting a hint. R --silent --nosave barebone.R should do it! Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 28-Apr-09 Time: 22:11:23 -- XFMail -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Installing/using glars package --- Error in library(glars) : 'glars' is not a valid installed package
Hi all I seem to have fallen at the first hurdle with my analysis, I have a set of binary disease outbreak data linked to a large number of landscape metrics variables and environmental variables which I would like to as predictor variables in a Least Angle Logistic Regression using the glars.fit.s function in the glars package (my data exhibits some multicollinearity hence the LARS) but when I try and load this in R (version 2.9.0) I get the following message library(glars) Error in library(glars) : 'glars' is not a valid installed package I have the windows binary for the glars package downloaded from the site below [the glars does not seem to be on the CRAN site, (LARS for linear least angle regression is and loads fine)] and unzipped in my library folder. http://csan.insightful.com/PackageDetails.aspx?Package=glars The package is written in the S-dialect but as far as I can tell from the literature it should run in both R and S-PLUS, the description file states: 'Package: glars Title: Generalized Least Angle Regression Version: 0.1.2' 'This is S+GLARS for S-PLUS or R' 'R (= 2.0)' 'Dialect: S-PLUS' Not sure if this is a general problem with loading an S dialect package and I need to add some thing else before loading the library if it is in S rather than R? or if it is a problem with the 'glar' package. Any suggestions/tips most appreciated, thanks in advance. Lara lara.har...@bbsrc.ac.uk __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] trouble with rgl on opensuse 11.1
Dear R People: I upgraded to Open Suse 11.1 and am having trouble with the rgl package, which I need for other applications. Here is the install output: install.packages(rgl,depen=TRUE) --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rgl_0.84.tar.gz' Content type 'application/x-gzip' length 1670659 bytes (1.6 Mb) opened URL == downloaded 1.6 Mb * Installing *source* package ‘rgl’ ... checking for gcc... gcc -std=gnu99 checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for gcc... (cached) gcc -std=gnu99 checking whether we are using the GNU C compiler... (cached) yes checking whether gcc -std=gnu99 accepts -g... (cached) yes checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed checking for libpng-config... yes configure: using libpng-config configure: using libpng dynamic linkage checking for X... libraries , headers checking GL/gl.h usability... yes checking GL/gl.h presence... yes checking for GL/gl.h... yes checking GL/glu.h usability... no checking GL/glu.h presence... no checking for GL/glu.h... no configure: error: missing required header GL/glu.h ERROR: configuration failed for package ‘rgl’ * Removing ‘/home/erin/Desktop/R-2.9.0/library/rgl’ The downloaded packages are in ‘/tmp/RtmpxqeD6b/downloaded_packages’ Updating HTML index of packages in '.Library' Warning message: In install.packages(rgl, depen = TRUE) : installation of package 'rgl' had non-zero exit status Any help would be much appreciate. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How do I sample cases within a matrix?
Hi R community, I am trying to obtain a sample from a matrix but sample(my.matrix) doesn't do what I need. I have a matrix of 1287 interactions between the species in columns and the species in rows and I want to obtain a smaller matrix with say, 800 interactions, that may or may not have the same number of columns and/or rows (i.e., some interactions may not be retrieved in a smaller sample). For example, my original mock matrix M is [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 The command sample(my.matrix) samples whole cells from my matrix, such that if the interaction between species 1 and 1 is included in the sample, they always show 140 interactions. But what I want is to sample cases within each cell. My sample matrix S could have =140 interactions between species 1 and 1, =100 between species 1 and 2, etc. Again, if some combination is absent from the sample matrix, that's OK. Here's my code, in case it helps: pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species m-pla%*%t(pol) #matrix of interactions according to pla and pol abundance m [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 sample(m) #doesn't give me what I want... I have searched the forum for an answer but all questions regarding sampling from matrices refer to sampling whole rows or columns, not cases within a matrix. Thanks in advance for any help! Silvia. -- View this message in context: http://www.nabble.com/How-do-I-sample-%22cases%22-within-a-matrix--tp23296664p23296664.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Out of memory issue
On Tue, 28 Apr 2009, Neotropical bat risk assessments wrote: Hi again all, I can read all of the data is in CSV format with a header row and with 1,200,240 rows. I can do all the plots and ggplot2 has no problems. Seems to be a problem with the MASS package??? It seems that the contour plots are the problem with the memory error. Error: cannot allocate vector of size 228.9 Mb I can run smaller data sets and do the contour plots w/o problems. The data can not really be summarized as I need to plot the actual values to get the insight into the large data sets. Why can't you divide the plot into, say, four regions with a quarter of the data and draw contours for each region, and then overlay the printed output? -thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Bounded memory ANOVA
If it is a fixed-effects ANOVA you can just use biglm(). Otherwise you could use biglm() to fit the necessary sequences of models to give the RSS that you need for the F-tests. -thomas On Tue, 28 Apr 2009, Hardi wrote: Hi, I'm using aov() to analyze the data and get the rank of factors. However, this does not work for larger set of data due to memory limitation. Are there any similar function to use aov() on data sets larger than memory similar to biglm ? Thanks, ~ Hardi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Thomas Lumley Assoc. Professor, Biostatistics tlum...@u.washington.eduUniversity of Washington, Seattle __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Normal distribution with R
If we knew two pth quantiles for a normal distribution, is it possible that we can find mean and sigma for the normal distribution using R? Let x ~ norm(mean, sigma). Suppose that qnorm(0.9,mean,sigma) and qnorm(0.1,mean,sigma) are known. Can we find mean and sigma using R? Thanks, -james __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 do I sample cases within a matrix?
If you just want to shuffle the row around, this should do it. By limiting the number of samples, you can get a smaller matrix: pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species m-pla%*%t(pol) #matrix of interactions m[sample(nrow(m)),] [,1] [,2] [,3] [,4] [,5] [1,] 126 90 81 36 18 [2,] 42 30 27 126 [3,] 70 50 45 20 10 [4,] 84 60 54 24 12 [5,] 140 100 90 40 20 m [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 On Wed, Apr 29, 2009 at 1:36 PM, Silvia Lomascolo slomasc...@gmail.com wrote: Hi R community, I am trying to obtain a sample from a matrix but sample(my.matrix) doesn't do what I need. I have a matrix of 1287 interactions between the species in columns and the species in rows and I want to obtain a smaller matrix with say, 800 interactions, that may or may not have the same number of columns and/or rows (i.e., some interactions may not be retrieved in a smaller sample). For example, my original mock matrix M is [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 12 6 The command sample(my.matrix) samples whole cells from my matrix, such that if the interaction between species 1 and 1 is included in the sample, they always show 140 interactions. But what I want is to sample cases within each cell. My sample matrix S could have =140 interactions between species 1 and 1, =100 between species 1 and 2, etc. Again, if some combination is absent from the sample matrix, that's OK. Here's my code, in case it helps: pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species m-pla%*%t(pol) #matrix of interactions according to pla and pol abundance m [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 12 6 sample(m) #doesn't give me what I want... I have searched the forum for an answer but all questions regarding sampling from matrices refer to sampling whole rows or columns, not cases within a matrix. Thanks in advance for any help! Silvia. -- View this message in context: http://www.nabble.com/How-do-I-sample-%22cases%22-within-a-matrix--tp23296664p23296664.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2 way ANOVA with possible pseudoreplication
Hi, I have an experiment with 2 independant factors which I have been trying to analyse in R. The problem is that there are several data points recorded on the same animal. However, no combination of treatments is repeated on the same animal. All possible combinations of treatments are done in a random order with as many points as possible being done on 1 animal before moving onto the next. The suggested way to remove pseudoreplication is to average the points from the same animal. However, as my measures on the same animal are of different treatment combinations so this makes no sense. It is also suggested that as I have random and fixed effects I should use a mixed effects model. However, given that my independant variables are factorial I am not sure how to incorporate this. I would be very grateful for any advice on methods of getting round this problem or whether I have sufficiently accounted from my none independant measures experimentally. Many thanks, Natalie -- View this message in context: http://www.nabble.com/2-way-ANOVA-with-possible-pseudoreplication-tp23295845p23295845.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re sidual variance in lmer
Hello everybody, using the lmer function, I have fitted the following logistic mixed regression model on an experimental data set containing one fixed factor (Cond) and three random variables (Sito, Area, Trans): model-lmer(Caul~Cond+(1|Sito)+(1|Area)+(1|Trans), data=dataset, family=binomial) this is the output: summary(model) Generalized linear mixed model fit by the Laplace approximation Formula: Caul ~ Cond + (1 | Sito) + (1 | Area) + (1 | Trans) Data: dataset AIC BIC logLik deviance 548.7 573.7 -268.3536.7 Random effects: Groups NameVariance Std.Dev. Trans (Intercept) 3.2313398 1.797593 Area (Intercept) 0.000 0.00 Sito (Intercept) 0.0047151 0.068667 Number of obs: 480, groups: Trans, 48; Area, 12; Sito, 2 As you can see the residual variance is missing. Can anybody tell me why? Does anybody know how can I get it? Thank you for your attention, I wish somebody can help me. Have a nice day, best regards, Tommaso Alestra -- View this message in context: http://www.nabble.com/Residual-variance-in-lmer-tp23295849p23295849.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] problems with clipboard
Thank you very much. I'll try. Jamie Kevin Middleton-3 wrote: Jamie, Try it as: data2 - read.table(pipe('pbpaste'), header = T) I have a read.clipboard() function defined in ~/.Rprofile: read.clipboard - function(){read.table(pipe('pbpaste'), header = T)} Also see the Clipboard section of ?pipe. Cheers, Kevin - Kevin M. Middleton Department of Biology California State University San Bernardino 5500 University Parkway San Bernardino CA 92407 On Apr 28, 2009, at 9:31 AM, Jamie.lannister wrote: Hi I'm a mac user. I have problems loading data from mac excel in R. I'm using these script: library(utils) data2 - read.table(file(clipboard), header =T, sep =\t) but this is the message that I have from R_ Error in open.connection(file, r) : cannot open the connection In addition: Warning message: In open.connection(file, r) : clipboard cannot be opened or contains no text More complicate then that is that sometimes it works sometimes no... I'm very confuse any help? Jamie -- View this message in context: http://www.nabble.com/problems-with-clipboard-tp23280578p23280578.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/problems-with-clipboard-tp23280578p23295814.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] library which convert dates
I'm looking for library which let mi convert dates for example like this: 00-06-05 00:00 00-08-06 00:00 00-08-16 00:00 00-05-23 00:00 00-01-14 00:00 00-10-28 00:00 and as a result I want to get a 3 levels -- View this message in context: http://www.nabble.com/library-which-convert-dates-tp23295853p23295853.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] problems with clipboard
Thank you very much! See, I'm a new user both for R and mac.. :-) Jamie. Prof Brian Ripley wrote: On Tue, 28 Apr 2009, Jamie.lannister wrote: Hi I'm a mac user. I have problems loading data from mac excel in R. I'm using these script: library(utils) data2 - read.table(file(clipboard), header =T, sep =\t) but this is the message that I have from R_ Error in open.connection(file, r) : cannot open the connection In addition: Warning message: In open.connection(file, r) : clipboard cannot be opened or contains no text More complicate then that is that sometimes it works sometimes no... I'm very confuse any help? See the help for 'file'. It says (on a Mac) that file(clipboard) reads the 'X11 primary selection', and also says Mac OS X users can use 'pipe(pbpaste)' and 'pipe(pbcopy, w)' to read from and write to that system's clipboard. The problem is that most windows managers on Unix-alikes have multiple clipboards and working out which text is in which clipboard is tricky, not least as some applications (and some window managers) try to be helpful and copy to more than one clipboard. That's why this may sometimes appear to work and sometimes not. -- Brian D. Ripley, rip...@stats.ox.ac.uk 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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/problems-with-clipboard-tp23280578p23295816.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How do I sample cases within a matrix?
Hi R community, I am trying to obtain a sample from a matrix but sample(my.matrix) doesn't do what I need. I have a matrix of 1287 interactions between the species in columns and the species in rows and I want to obtain a smaller matrix with say, 800 interactions, that may or may not have the same number of columns and/or rows (i.e., some interactions may not be retrieved in a smaller sample). For example, my original mock matrix M is [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 The command sample(my.matrix) samples whole cells from my matrix, such that if the interaction between species 1 and 1 is included in the sample, they always show 140 interactions. But what I want is to sample cases within each cell. My sample matrix S could have =140 interactions between species 1 and 1, =100 between species 1 and 2, etc. Again, if some combination is absent from the sample matrix, that's OK. pla- c(10, 9, 6, 5, 3) #abundance of pla species pol- c(14, 10, 9, 4, 2) #abundance of pol species m-pla%*%t(pol) #matrix of interactions according to pla and pol abundance m [,1] [,2] [,3] [,4] [,5] [1,] 140 100 90 40 20 [2,] 126 90 81 36 18 [3,] 84 60 54 24 12 [4,] 70 50 45 20 10 [5,] 42 30 27 126 sample(m) #doesn't give me what I want... I have searched this forum for an answer but all questions regarding sampling from matrices refer to sampling whole rows or columns, not cases within a matrix. Thanks in advance for any help! Silvia. -- View this message in context: http://www.nabble.com/How-do-I-sample-%22cases%22-within-a-matrix--tp23296005p23296005.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Optim and hessian
Hi, my name is Marcel R. Lopes. My problem is, I made a code to calculate the estimates of a Cox model with random effects. Used to optimize the R command for this. The estimates were calculated correctly, but the Hessian matrix does not have good values. The same thing was done in SAS and gave good results for the Hessian Matrix. Where is the problem in R? As the Hessian is calculated?. How could I solve this problem?. I would be grateful if you could help me [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] mode(x) - double
Hi, I need your help!! I imported a big coloumn vector from a txt file but it results as mode :list I want to change it in numeric otherwise I can't do my analysis. This is what i get: mode (data) - double Error in eval(expr, envir, enclos) : (list) object cannot be coerced to type 'double' Thanks a lot!!! Alessandra -- View this message in context: http://www.nabble.com/mode%28x%29-%3C--%22double%22-tp23296727p23296727.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] AICc
I am fitting logistic regression models, by defining my own link function, and would like to get AICc values. Using the glm command gives a value for AIC, but I haven't been able to get R to convert that to AICc. Is there a code that has already been written for this? Right now I am just putting the AIC values into an excel spreadsheet and calculating AICc, likelihood, and AIC weights that way, but it would be much more efficient if I could do this in R. Thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Selecting vector elements using other vectors
Dear R-Help, I have a data frame and a vector df=data.frame(Letter=c(Z,Q,R,A,E,F), Number=c(11,32,4,1,9,3)) v=c(C,Q,R,A,E) From df, I'd like to construct a subset of the field Number, with deletions dictated by the vector, v, of letters. I've succeeded in doing this for a single deletion (for example Letter=Q) with the following df$Number[df$Letter != v[2]] but am struggling do more than one at a time. For example, df$Number[df$Letter != v[2:5]] gives the error: Warning messages: 1: Is.na(e1) | is.na(e2) : longer object length is not a multiple of shorter object length 2: In. Perhaps there is a much easier way to approach this... Any help would be greatly appreciated! Alastair -- View this message in context: http://www.nabble.com/Selecting-vector-elements-using-other-vectors-tp23296130p23296130.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Error with Design.Function(fit)
Hi all, I'm reposting this with a more appropriate subject. Do I need to define limits as the error message seems to suggest? If so, how? The error message, my code, the output and the first few lines of my data are all below. Thank you! Error in Getlim(at, allow.null = TRUE, need.all = TRUE) : variable dmodel.df does not have limits defined in fit or with datadist My code: == library(Hmisc); library(Design); library(lattice); dmodel.df = read.table(./data_cub3.txt, header=TRUE, nrows=100) f - ols(dmodel.df$y1 ~ rcs(dmodel.df$x1,3) ) print(f) dd - datadist(dmodel.df$x1) options(datadist=dd) describe(dmodel.df) print( Function(f) ) plot(dmodel.df$x1, dmodel.df$y1) plot(f, add=TRUE, col=blue, pch=2) Output: Linear Regression Model ols(formula = dmodel.df$y1 ~ rcs(dmodel.df$x1, 3)) n Model L.R. d.f. R2 Sigma 100 501.6 2 0.9934 45128 Residuals: Min 1Q Median 3Q Max -68644.8 -31355.6 -849.9 31823.3 154196.6 Coefficients: Value Std. Error t Pr(|t|) Intercept 3592512789.6 2.809 0.0060121 dmodel.df -1620 422.9 -3.832 0.0002260 dmodel.df' 25202 523.9 48.102 0.000 Residual standard error: 45130 on 97 degrees of freedom Adjusted R-Squared: 0.9932 Error in Getlim(at, allow.null = TRUE, need.all = TRUE) : variable dmodel.df does not have limits defined in fit or with datadist Sample data: = configbenchmarkx1noisey1 1verify210.72282 2verify221.6256 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] library which convert dates
look at zoo and chron On Wed, Apr 29, 2009 at 8:54 AM, Grześ gregori...@gmail.com wrote: I'm looking for library which let mi convert dates for example like this: 00-06-05 00:00 00-08-06 00:00 00-08-16 00:00 00-05-23 00:00 00-01-14 00:00 00-10-28 00:00 and as a result I want to get a 3 levels -- View this message in context: http://www.nabble.com/library-which-convert-dates-tp23295853p23295853.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Dynamic visualisation of R data using Adobe FLEX
Hi useRs, I had posted about Adobe FLEX talking to R for rich visualisation. Reply from Jeffery Horner contained links to the revolution-computing.com webpage which had information pertaining to the Bay Users R group Meetup on Web Dashboards with R. I have a very specific project that I need to implement. I wish to use the graphics capabilities provided by Adobe FLEX to visualise outputs from R. For example: I would like to fit a regression model to a dataset in R and provide a FLEX interface wherein, a user may manipulate a slider which would increase or decrease a parameter estimate (between the confidence intervals of the estimate) of a variable to see the effect on the predicted values. I necessarily have to use FLEX for the interface. In trying to make sense of how to go about this task, I have speculated on the following technologies: 1) Using RSOAP which requires a Python client. I am not sure how I can implement this in Flex. 2) Using RSOAP provided by the Biocep project. This is a java implementation and maybe this would suit my requirements. 3) The StatDataML package in R provides the creation of xml files of R objects. Maybe I can use these XML files as encapsulators of R object data and pass it on to FLEX. 4) Since R has interfaces that connect to most SQL database servers, I can convert results of lm objects (summary(lmobject)) to data frames and push them into the SQL database. FLEX can then read the table and extract the relevant fields for output. I am aware that I not a computer programmer which is why I may not be making a whole lot of sense in describing the above scenarios, but I am trying to gain as much information and programming skills to 'decipher' the secret behind using FLEX and R. I have looked at Jeffery Horner's BBPLOT project (http://data.vanderbilt.edu/rapache/bbplot) and honestly I'm amazed. Replicating this with a FLEX interface is the closest I can get in describing my requirements. Any information/technical sources/tutorials etc in this regard will be much appreciated. Thank you for your time. Regards Harsh Singhal Decision Systems Mu Sigma Inc. Chicago, IL __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RODBC inside MS Access Sub
HI: Is it possible to use the RODBC package within MS Access. I have been using from R but was just wondering if it could be used along with R(D)COM. Something like this: Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim myApp As StatConnector Set myApp = New StatConnector myApp.GetErrorText myApp.Init R myApp.EvaluateNoReturn library(RODBC) myApp.EvaluateNoReturn myDB - odbcConnectAccess(CurrentDb) 'query the database and save it as R object 'a' myApp.EvaluateNoReturn a - sqlQuery(CurrentDb, Paste(select * From Sample)) myApp.EvaluateNoReturn plot(a) Thanks in advance Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Normal distribution with R
Hi James its just simple calculus, since with q90-qnorm(.9,me,sd) q10-qnorm(.1,me,sd) mean-(q90+q10)/2# the normal distribution is symmetric around the mean sd-(q90-q10)/ (qnorm(.9)-qnorm(.1)) # between 10th and 90th are qnorm(.9)-qnorm(.1)=2.563103sds hth. g...@ucalgary.ca schrieb: If we knew two pth quantiles for a normal distribution, is it possible that we can find mean and sigma for the normal distribution using R? Let x ~ norm(mean, sigma). Suppose that qnorm(0.9,mean,sigma) and qnorm(0.1,mean,sigma) are known. Can we find mean and sigma using R? Thanks, -james __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Eik Vettorazzi Institut für Medizinische Biometrie und Epidemiologie Universitätsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/42803-8243 F ++49/40/42803-7790 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Evaluation of an expression as function argument
Dear R-users, I would like to know if is it possible to set a function argument as an evaluated expression. I have tried several syntaxes, including the following example, but could not get it anything to run. The plot function is used here but I would like to later apply the same approach to other functions. ## items - c(expression(col=2),expression(pch=2)) for (in in seq(2)) { plot(1:10, eval(items[i])) } ## Thanks in advance for your input. Sebastien __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Optim and hessian
Are you using optim() function in R? Although I am not sure what your problem really is (as you haven't provided sufficient information), it may be that the hessian computation in optim() is not accurate enough for you. Try the function hessian() in the numDeriv package. It is very accurate. Here is an example: require(numDeriv) # to compute hessian fr - function(x) { ## Rosenbrock Banana function x1 - x[1] x2 - x[2] 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } ans - optim(par=c(-1,1), fn=fr, method=BFGS) hess - hessian(x=ans$par, func=fr) hess Hope this helps, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Marcel Rodrigues Lopes Sent: Wednesday, April 29, 2009 10:42 AM To: r-help@r-project.org Subject: [R] Optim and hessian Hi, my name is Marcel R. Lopes. My problem is, I made a code to calculate the estimates of a Cox model with random effects. Used to optimize the R command for this. The estimates were calculated correctly, but the Hessian matrix does not have good values. The same thing was done in SAS and gave good results for the Hessian Matrix. Where is the problem in R? As the Hessian is calculated?. How could I solve this problem?. I would be grateful if you could help me [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 model with garch errors
Dear R experts, I am trying to estimate an ARMA 2,2 model with garch errors. I used the following code on R 2.9. #library library(fGarch) #data data1-ts(read.table(C:/Users/falcon/Desktop/Time Series/exports/goods1.csv), start=c(1992,1), frequency=12) head(data1) #garch garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1) but get this error: garchFit(formula.mean= ~arma(2,2),formula.var=~garch(1,1), data=data1) Error in garchFit(formula.mean = ~arma(2, 2), formula.var = ~garch(1, : element 1 is empty; the part of the args list of 'length' being evaluated was: (formula) what am I doing wrong? any help would be greatly appreciated joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 converting for loop to vector operation
Dear List, I have a wrapper function that draws a graph that I'd like to use in a vector-like manner. The for-loop version I currently use is below. library(ggplot2) data(economics) h - 600 w - 800 #-- draw_metric_by_date - function( df, i, smooth=FALSE, BASEPATH ) { mlabel - names(df)[i] qmetric - qplot( data=df, x=date, y=df[,i], geom=c('line','jitter'), ylab=mlabel, main=mlabel, colour=I(dark blue) ) if ( smooth == TRUE ) { print(smoother requested...) tmp - qmetric qmetric - tmp + stat_smooth() } pngfn - paste( BASEPATH, mlabel, .png, sep=) print(pngfn) png( file=pngfn, height=h, width=w ) print(qmetric) dev.off() } basepath - C:/tmp for ( i in c(2:6) ) { print(names(economics)[i]) draw_metric_by_date( economics, i, smooth=TRUE, basepath ) } Could someone show me how to do the same with a vector approach with an apply function ? Many thanks, Avram __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Hierarchical Diagram of Networks in sna or otherwise?
I've been using sna to work with some networks, and am trying to visualize them easily. My networks are hierarchical (food webs). All of the layout engines I've tried with gplot don't seem to plot hierarchical networks, as one would using dot from graphviz. While I could do all of this by outputting to dotfiles and running it through graphviz, the graphics I get from R are much cleaner, and more easily integrated into my analyses. Is there any good way to diagram a hierarchical network in R, either with the sna library or otherwise? It strikes me that at least the Netindices package can calculate trophic levels. Could this be used for node placement? -Jarrett -- View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23301819.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Newbie R question PART2
Hi, Thank you for littler webpage. It is quite interesting. Tena Sakai tsa...@gallo.ucsf.edu -Original Message- From: Wacek Kusnierczyk [mailto:waclaw.marcin.kusnierc...@idi.ntnu.no] Sent: Wed 4/29/2009 1:22 AM To: Tena Sakai Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Newbie R question PART2 Tena Sakai wrote: Hi, That's pretty impressive performance, but wait. Where does this little r come from? And how does it differ from its big brother? the little r comes from littler [1]. it doesn't claim to be larger than it is. [1] http://dirk.eddelbuettel.com/code/littler.html [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.