[R] (no subject)
Hallo. Could you please tell me if it is possible in R use something like for-cycle or conditions with if and then. I would need to index z from 0 to m and repeat some operations on each of them. Could you please write me how can I do this? Thank you very much Barbora Kocurova __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot curves with more than 8 colors
Vincent Deng wrote: Hi, I'm a new hand in R language. I have about 20 groups of data[x,y] and want to plot them on a graph. To do this, I write a for-loop as following: (some codes are omitted for simplicity) for (i in c(1:20)) { points(...,...,col=i) lines(...,col=i) } The problem is R only plot them with 8 colors repeatly. Could anyone help me solve this problem? Or is there any package providing plot function without color limit? After typing ?colors I get a nice help page that points me to a lot of other functions that generate more than 8 colors. Maybe your installation of R is broken and you cannot see this help page? You certainly tried to get help on colors as well. There is no limit of the color number in the functions above, simply specify the color you want to get. The only color limit applies for the device and for most devices and rgb colors this is 256^3. Uwe Ligges Best Regards... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] is R a programming language?; was: (no subject)
Barbora Kocúrová wrote: Hallo. Could you please tell me if it is possible in R use something like for-cycle or conditions with if and then. I would need to index z from 0 to m and repeat some operations on each of them. Could you please write me how can I do this? What about reading the manual? Such simple operations are explained there in detail. Thank you very much Barbora Kocurova __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Yes, please do! Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
?Control but there are alternative ways : sapply(), apply(), lapply()... ifelse() etc. Barbora Kocúrová a écrit : Hallo. Could you please tell me if it is possible in R use something like for-cycle or conditions with if and then. I would need to index z from 0 to m and repeat some operations on each of them. Could you please write me how can I do this? Thank you very much Barbora Kocurova __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Seg fault with trace
hadley wickham wrote: (Under 2.2.0, Mac) I have been unable to reduce this to a simple case, so I'll include my full code, and my intentions. The problem I'm trying to solve is that while many defaults (eg. na.rm=F, drop=T) make sense for interactive programming, they tend to be a bit of a pain when developing a package. For example, I often forget to use drop=FALSE, only test with multiple columns and then spend ages trying to figure out why it doesn't work when I use the function with a single column. The idea of the functions below is to automatically warn me when I do something like that. trace_all - function(fs, tracer) { sapply(fs, trace, tracer=tracer, print=FALSE) return() } functions_with_arg - function(arg, pos) { fs - ls(pos=pos) present - unlist(lapply(fs, function(x) is.function(get(x)) !is.null(formals(x)[[arg]]))) fs[present] } trace_all(list(sum), quote(if (!na.rm) warning(na.rm = FALSE))) # Works trace_all(functions_with_arg(na.rm, package:base), quote(if (!na.rm) warning(na.rm = FALSE))) # Segfaults I'd be happy to explore alternative approaches, especially since this approach modifies the functions in their original namespaces, and I only want to see the warnings when my functions use these functions. Does not segfault for me with R-2.2.1, neither on Windows nor on Linux. For any follow-ups I recommend to use the R-devel list for this kind of function and probable segfault problems. Uwe Ligges Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] reference
I have recently used R in a statistical analysis and I need to use a reference... If you would be kind enough to help me I would be grateful! P.S.Georgoulia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reference
http://www.rpad.org/Rpad/R-refcard.pdf I have recently used R in a statistical analysis and I need to use a reference... If you would be kind enough to help me I would be grateful! P.S.Georgoulia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reference
Παναγιωτα Γεωργουλια wrote: I have recently used R in a statistical analysis and I need to use a reference... If you would be kind enough to help me I would be grateful! Please read either the message at the very beginning of your R session, the R FAQ, or ... and type: citation() Uwe Ligges P.S.Georgoulia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Create pdf and postscript files
Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) postscript(H:/Perso/essai.ps) But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Create pdf and postscript files
You need to open the pdf/poscript first and then plot...see ?postscript # open the file foo.ps for graphics output postscript(foo.ps) # produce the desired graph(s) dev.off() # turn off the postscript device David Hajage wrote: Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) postscript(H:/Perso/essai.ps) But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Create pdf and postscript files
David Hajage wrote: Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) You opened a device, say A. postscript(H:/Perso/essai.ps) You opened another device say B. All your plotting will now go into device B until you close it by dev.off(), then all further plotting goes into device A - unless you start another device. Uwe Ligges But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Create pdf and postscript files
... I'm so stupid ! Thank you very much. David Hajage Interne de santé publique Institut Curie 2005/12/27, Ronnie Babigumira [EMAIL PROTECTED]: You need to open the pdf/poscript first and then plot...see ?postscript # open the file foo.ps for graphics output postscript(foo.ps) # produce the desired graph(s) dev.off() # turn off the postscript device David Hajage wrote: Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) postscript(H:/Perso/essai.ps) But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- David [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Create pdf and postscript files
Not at all...on the contrary, these are common slips as one is getting started and they can be nerve wrecking (I have only been using R for a month and I have had my fair share of them). Be sure to make RSiteSearch a good friend, very helpful. Happy new year David Hajage wrote: ... I'm so stupid ! Thank you very much. David Hajage Interne de santé publique Institut Curie 2005/12/27, Ronnie Babigumira [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: You need to open the pdf/poscript first and then plot...see ?postscript # open the file foo.ps http://foo.ps for graphics output postscript(foo.ps http://foo.ps) # produce the desired graph(s) dev.off() # turn off the postscript device David Hajage wrote: Hello, I would like to learn how to create a pdf and a postscript file from an R graphic. For example, I tried : plot(1) # example pdf(H:/Perso/essai.pdf) postscript(H:/Perso/essai.ps) But the pdf document created is empty. How do these functions work ? Thank you very much. -- David Hajage Interne de santé publique Institut Curie [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailto:R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- David __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot curves with more than 8 colors
Dear Uwe, Sorry, I did not describe my question clearly. I created a matrix to store color code using rgb function. abc = rgb(6:36,0,0,maxColorValue = 255) And after running codes like this for (i in c(1:20)) { points(...,...,col=abc[i]) lines(...,col=abc[i]) } R still used 8 colors of abc color codes repeatedly to draw the diagram Any helps? Best Regards... On 12/27/05, Uwe Ligges [EMAIL PROTECTED] wrote: Vincent Deng wrote: Hi, I'm a new hand in R language. I have about 20 groups of data[x,y] and want to plot them on a graph. To do this, I write a for-loop as following: (some codes are omitted for simplicity) for (i in c(1:20)) { points(...,...,col=i) lines(...,col=i) } The problem is R only plot them with 8 colors repeatly. Could anyone help me solve this problem? Or is there any package providing plot function without color limit? After typing ?colors I get a nice help page that points me to a lot of other functions that generate more than 8 colors. Maybe your installation of R is broken and you cannot see this help page? You certainly tried to get help on colors as well. There is no limit of the color number in the functions above, simply specify the color you want to get. The only color limit applies for the device and for most devices and rgb colors this is 256^3. Uwe Ligges Best Regards... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot curves with more than 8 colors
Vincent Deng wrote: Dear Uwe, Sorry, I did not describe my question clearly. I created a matrix to store color code using rgb function. abc = rgb(6:36,0,0,maxColorValue = 255) And after running codes like this for (i in c(1:20)) { points(...,...,col=abc[i]) lines(...,col=abc[i]) } R still used 8 colors of abc color codes repeatedly to draw the diagram Any helps? No, it does not (in fact, all appears to be more or less black on my screen ;-)). Another example: plot(1:255, col=rgb(1:255,0,0,maxColorValue = 255)) Uwe Ligges Best Regards... On 12/27/05, Uwe Ligges [EMAIL PROTECTED] wrote: Vincent Deng wrote: Hi, I'm a new hand in R language. I have about 20 groups of data[x,y] and want to plot them on a graph. To do this, I write a for-loop as following: (some codes are omitted for simplicity) for (i in c(1:20)) { points(...,...,col=i) lines(...,col=i) } The problem is R only plot them with 8 colors repeatly. Could anyone help me solve this problem? Or is there any package providing plot function without color limit? After typing ?colors I get a nice help page that points me to a lot of other functions that generate more than 8 colors. Maybe your installation of R is broken and you cannot see this help page? You certainly tried to get help on colors as well. There is no limit of the color number in the functions above, simply specify the color you want to get. The only color limit applies for the device and for most devices and rgb colors this is 256^3. Uwe Ligges Best Regards... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (no subject)
Is Barbara asking a much more basic question that is really RTFM? Apart from the apply family of commands, the S language as implemented in R includes a lot of looping: m-3 for (z in 0:m){ if(z0){ cat(z non-zero\n) }else{ cat(z is zero\n) } } gives: z is zero z non-zero z non-zero z non-zero As Jacques points out, typing ?Control will give a good overview of the flow control features available, starting with: if(cond) expr if(cond) cons.expr else alt.expr for(var in seq) expr while(cond) expr repeat expr break next Following the links at the bottom of that help page will reveal the richness of R commands (it's easier if you use a browser for help). I really suggest one of the excellent books on S/R such as MASS. After all, as many of these are written by R contributors, it is a way of making some small financial acknowledgement...:-) Best wishes and Happy New Year to all John John Logsdon Try to make things as simple Quantex Research Ltd, Manchester UK as possible but not simpler [EMAIL PROTECTED] [EMAIL PROTECTED] +44(0)161 445 4951/G:+44(0)7717758675 www.quantex-research.com On Tue, 27 Dec 2005, Jacques VESLOT wrote: ?Control but there are alternative ways : sapply(), apply(), lapply()... ifelse() etc. Barbora Kocúrová a écrit : Hallo. Could you please tell me if it is possible in R use something like for-cycle or conditions with if and then. I would need to index z from 0 to m and repeat some operations on each of them. Could you please write me how can I do this? Thank you very much Barbora Kocurova __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Add notes to a graph
Ronnie Babigumira skrev: Hi, I have done a search on this in vain. How can I add a note to the foot of a graph example below Can you use this?: plot(1:10, 1:10, main = Maintitle, sub = subtitle) mtext(Another possibillity, side=4) |---| | Title | | | | | my | | | | graph | | | | | | | | __| | |note: source | |---| Many thanks Ronnie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Add notes to a graph
Closer to what Ronnie needs is: plot(1:10, 1:10, main = Title) mtext(Note: source,side=1,line=4,adj=0) The line number may need adjustment. Best wishes John John Logsdon Try to make things as simple Quantex Research Ltd, Manchester UK as possible but not simpler [EMAIL PROTECTED] [EMAIL PROTECTED] +44(0)161 445 4951/G:+44(0)7717758675 www.quantex-research.com On Tue, 27 Dec 2005, Ener Borg wrote: Ronnie Babigumira skrev: Hi, I have done a search on this in vain. How can I add a note to the foot of a graph example below Can you use this?: plot(1:10, 1:10, main = Maintitle, sub = subtitle) mtext(Another possibillity, side=4) |---| |Title | | | | | my | | | | graph | | | | | | | | __| | |note: source | |---| Many thanks Ronnie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Add notes to a graph
Many thanks John. John Logsdon wrote: Closer to what Ronnie needs is: plot(1:10, 1:10, main = Title) mtext(Note: source,side=1,line=4,adj=0) The line number may need adjustment. Best wishes John John Logsdon Try to make things as simple Quantex Research Ltd, Manchester UK as possible but not simpler [EMAIL PROTECTED] [EMAIL PROTECTED] +44(0)161 445 4951/G:+44(0)7717758675 www.quantex-research.com On Tue, 27 Dec 2005, Ener Borg wrote: Ronnie Babigumira skrev: Hi, I have done a search on this in vain. How can I add a note to the foot of a graph example below Can you use this?: plot(1:10, 1:10, main = Maintitle, sub = subtitle) mtext(Another possibillity, side=4) |---| |Title | | | | | my | | | | graph | | | | | | | | __| | |note: source | |---| Many thanks Ronnie __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help.start() doesn't work
I installed the latest R-package R-2.1.1-1.rh4AS.i686.rpm on a Red Hat Desktop 4 (RH EL4) machine. When I try to get help by the help.start() command an error message appears: - help.start() Making links in per-session dir ... If '/usr/bin/mozilla' is already running, it is *not* restarted, and you must switch to its window. Otherwise, be patient ... sh: /usr/bin/mozilla: Datei oder Verzeichnis nicht gefunden sh: /usr/bin/mozilla: Datei oder Verzeichnis nicht gefunden - The firefox browser is installed in /usr/lib/firefox-1.0.7 by default. How can I change R's browser path? Thank you. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help.start() doesn't work
Andreas Zocher [EMAIL PROTECTED] writes: I installed the latest R-package R-2.1.1-1.rh4AS.i686.rpm on a Red Hat Desktop 4 (RH EL4) machine. When I try to get help by the help.start() command an error message appears: - help.start() Making links in per-session dir ... If '/usr/bin/mozilla' is already running, it is *not* restarted, and you must switch to its window. Otherwise, be patient ... sh: /usr/bin/mozilla: Datei oder Verzeichnis nicht gefunden sh: /usr/bin/mozilla: Datei oder Verzeichnis nicht gefunden - The firefox browser is installed in /usr/lib/firefox-1.0.7 by default. How can I change R's browser path? options(browser=/usr/bin/firefox) is one way. Setting the environment variable R_BROWSER (before starting R) is another. And meddling with the Renviron file, personal or system-wide, is a third method. This information does seem to be a bit tricky to dig out from the R documentation, especially the R_BROWSER bit. I can only find a somewhat oblique reference in the R-admin manual and of course ?Startup points you towards the Renvironment files and $RHOME/etc/Renviron demonstrates what you can set and how. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help.start() doesn't work
On Tue, 27 Dec 2005, Peter Dalgaard wrote: Andreas Zocher [EMAIL PROTECTED] writes: I installed the latest R-package R-2.1.1-1.rh4AS.i686.rpm on a Red Hat Desktop 4 (RH EL4) machine. When I try to get help by the help.start() command an error message appears: - help.start() Making links in per-session dir ... If '/usr/bin/mozilla' is already running, it is *not* restarted, and you must switch to its window. Otherwise, be patient ... sh: /usr/bin/mozilla: Datei oder Verzeichnis nicht gefunden sh: /usr/bin/mozilla: Datei oder Verzeichnis nicht gefunden - The firefox browser is installed in /usr/lib/firefox-1.0.7 by default. How can I change R's browser path? options(browser=/usr/bin/firefox) is one way. Setting the environment variable R_BROWSER (before starting R) is another. And meddling with the Renviron file, personal or system-wide, is a third method. This information does seem to be a bit tricky to dig out from the R documentation, especially the R_BROWSER bit. I can only find a somewhat oblique reference in the R-admin manual and of course ?Startup points you towards the Renvironment files and $RHOME/etc/Renviron demonstrates what you can set and how. But the problem here is installing an RPM with a missing dependency If you are going to install binary versions of R you must be on the lookout for such things (which seem quite common, unfortunately). In this case it is much preferable to install R from the sources (or SRPM) to get a current version of R, and then the section `Setting the browser' of the R-admin manual is obviously relevant. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reference
citation() On 27-Dec-05, at 2:41 AM, Παναγιωτα Γεωργουλια wrote: I have recently used R in a statistical analysis and I need to use a reference... If you would be kind enough to help me I would be grateful! P.S.Georgoulia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Show graph integrated to GUI
The slider function in the TeachingDemos and relax packages (same function is in both packages you can use either) provides a way to do this using a Tk window. There are also several functions in the TechingDemos package that use a lower level interface to a Tk window that you can look at their source code as an example to build your own (examples include: vis.gamma, rotate.persp, and run.power.examp). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chihiro Kuraya Sent: Saturday, December 24, 2005 9:53 PM To: r-help@stat.math.ethz.ch Subject: [R] Show graph integrated to GUI Hi all, It it posssible to show graph which is integrated to some GUI (e.g. TclTk or R-wxPython). I want to make an application by R, for example, like the following picture: http://www.natch.co.uk/downloads/SigJenny/SJnScreenShot.gif Regards, Chihiro Kuraya -- STOP HIV/AIDS. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] glmmPQL and variance structure
Dear listers, glmmPQL (package MASS) is given to work by repeated call to lme. In the classical outputs glmmPQL the Variance Structure is given as fixed weights, Formula: ~invwt. The script shows that the function varFixed() is used, though the place where 'invwt' is defined remains unclear to me. I wonder if there is an easy way to specify another variance structure (eg varPower, etc..), preferably using an lme object of the varFunc classes ? Some trials show that the 'weights' argument of glmmPQL is just the same as in glm (which is clearly stated in the help) and I wonder actually, if not a nonsense, how to pass eg a 'weights' arguments as used in lme (eg weights=varPower()) to specify a variance function (in the same way as a correlation structure can be passed easy). Thanks in advance for any hint, Patrick __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] factorial anova
Thanks a lot to all of your responses, I did follow your adivces, but finnally to really get it understanded I acctually did the work to calculate the anova step by step on an excel spread sheet to see if I get the same SS and MS as is aov output, and yes, they are the same, so John you are right the data is kind of freak... My only preliminary survye was to make a boxplot of the interaction, where data is acctually correlated, but I did not expect that this correlation would result in identical sum of squares between tretment and interaction... kind of odd... Thanks again for your comments and suggestions, I learned some new functions I was not using... Happy New 2006, for all of you, enjoy the party!!! Cheers Petra El mar, 27-12-2005 a las 13:13, John Wilkinson escribió: Petra, It looks as though the problem is with your data. Reading it into 'R' gives--- dat-read.table(clipboard,header=T,sep=) dat Bosque estado lux dosel 1 deciduo pristino 703 88.56 2 deciduo pristino 800 90.64 3 deciduo pristino 150 95.84 4 deciduo pristino 245 87.52 5 deciduo pristino 1300 91.68 6 deciduo activo 1900 26.16 7 deciduo activo 840 59.44 8 deciduo activo 323 69.84 9 deciduo activo 112 75.04 10 deciduo activo 1360 51.12 11 siemprev activo 900 41.76 12 siemprev activo 480 65.68 13 siemprev activo 350 78.16 14 siemprev activo 350 37.60 15 siemprev activo 272 58.40 16 siemprev pristino 100 94.80 17 siemprev pristino 60 95.84 18 siemprev pristino 50 97.92 19 siemprev pristino 270 94.80 20 siemprev pristino 110 97.92 a straight analysis of variance (aov) model gives-- dat.aov-aov(dosel~estado*Bosque,data=dat) summary(dat.aov) Df Sum Sq Mean Sq F valuePr(F) estado 1 6931.1 6931.1 41.6455 7.974e-06 *** Bosque 1 36.636.6 0.21970.6456 estado:Bosque 1 36.636.6 0.21970.6456 Residuals 16 2662.9 166.4 showing that Bosque and its interaction with estado do indeed have the same 'sum of squares' of 36.6 a preliminary exploration of the data's factors shows-- with(dat,tapply(dosel,list(estado,Bosque),mean)) deciduo siemprev activo56.320 56.320 pristino 90.848 96.256 with(dat,tapply(dosel,list(estado,Bosque),sd)) deciduo siemprev activo 19.232972 16.817800 pristino 3.239062 1.577238 This shows that the levels of the factors are highly corelated the linear model and its anova confirms this-- fit.lm-lm(dosel~estado*Bosque,data=dat) summary(fit.lm) Call: lm(formula = dosel ~ estado * Bosque, data = dat) Residuals: Min 1Q Median 3Q Max -30.160 -2.548 0.312 3.588 21.840 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 5.632e+01 5.769e+009.762 3.84e-08 *** estadopristino3.453e+01 8.159e+004.232 0.000635 *** Bosquesiemprev1.249e-15 8.159e+00 1.53e-16 1.00 estadopristino:Bosquesiemprev 5.408e+00 1.154e+010.469 0.645622 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 12.9 on 16 degrees of freedom Multiple R-Squared: 0.7245, Adjusted R-squared: 0.6729 F-statistic: 14.03 on 3 and 16 DF, p-value: 9.615e-05 anova(fit.lm) Analysis of Variance Table Response: dosel Df Sum Sq Mean Sq F valuePr(F) estado 1 6931.1 6931.1 41.6455 7.974e-06 *** Bosque 1 36.636.6 0.21970.6456 estado:Bosque 1 36.636.6 0.21970.6456 Residuals 16 2662.9 166.4 the drop function shows that the model would improve by dropping the interaction term and so reducing the RSS (by 36.56, being the redundant interaction Sum of Sq) drop1(fit.lm).The AIC confirms this (the lower the better). Single term deletions Model: dosel ~ estado * Bosque Df Sum of Sq RSS AIC none 2662.90 105.83 estado:Bosque 1 36.56 2699.46 104.10 The only sig effect of the model is thus between estado levels. pristino effect being *** sig greater than activo for both levels of Bosque ( as the tapply table above clearly shows) It pays to do a preliminary survry of the data. I hope that helps, John -- Petra Wallem Centro de Estudios Avanzados en Ecología Biodiversidad (CASEB) Departamento de Ecología Facultad de Ciencias Biológicas Pontificia Universidad Católica de Chile Av. Libertador Bernardo O'Higgins # 340 Casilla 114-D __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] parameterization of factor in R
Hi all, I encountered this problem with parameterization in R: I have two factors in a regression. how about if I want to set constraint so that for each factor, the sum of their coefficients equals to zero(instead of choosing a reference category)? for example, I have factor(variable) A(with three categories) and factor(variable) B(with 4 categories), and I want to parameterize so that the sum of the three coefficients of A = 0, and sum of the four coefficients of B = 0? I mean how to do it in R? Oana _ Dont just search. Find. Check out the new MSN Search! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] parameterization of factor in R
?contr.sum And Chapter 6 of MASS would have explained all this to you, so if you have further questions please consult it. On Tue, 27 Dec 2005, Oana Mocila wrote: I encountered this problem with parameterization in R: I have two factors in a regression. how about if I want to set constraint so that for each factor, the sum of their coefficients equals to zero(instead of choosing a reference category)? for example, I have factor(variable) A(with three categories) and factor(variable) B(with 4 categories), and I want to parameterize so that the sum of the three coefficients of A = 0, and sum of the four coefficients of B = 0? I mean how to do it in R? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] parameterization of factor in R
If you are not familiar with MASS (Modern Applied Statistics with S, 4th ed, Venables and Ripley 2002, Springer), I can assure you it is an excellent reference for learning R. There are many books on R that I have not read, but among the books in my personal library, I refer to MASS fairly frequently. If it is beyond your budget and not in a local library, I encourage you to investigate the possibility of having that library obtain a copy. If the library needs justification, please explain what you know of the book, how it became recommended for you, the problems you hope it will help you solve, etc. Spencer Graves Prof Brian Ripley wrote: ?contr.sum And Chapter 6 of MASS would have explained all this to you, so if you have further questions please consult it. On Tue, 27 Dec 2005, Oana Mocila wrote: I encountered this problem with parameterization in R: I have two factors in a regression. how about if I want to set constraint so that for each factor, the sum of their coefficients equals to zero(instead of choosing a reference category)? for example, I have factor(variable) A(with three categories) and factor(variable) B(with 4 categories), and I want to parameterize so that the sum of the three coefficients of A = 0, and sum of the four coefficients of B = 0? I mean how to do it in R? -- Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA [EMAIL PROTECTED] www.pdf.com http://www.pdf.com Tel: 408-938-4420 Fax: 408-280-7915 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] off topic A4 paper
Dear R People: Please excuse the off topic question. What are the dimensions of A-4 Paper, please? Actually, the question should read, how do I set up a LaTex file to fix A-4 paper, please? Thanks much! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] off topic A4 paper
On Tue, 2005-12-27 at 16:16 -0600, Erin Hodgess wrote: Dear R People: Please excuse the off topic question. What are the dimensions of A-4 Paper, please? Actually, the question should read, how do I set up a LaTex file to fix A-4 paper, please? Thanks much! Set the documentclass in your LaTeX source file to: \documentclass[a4paper]{...} as opposed to: \documentclass[letterpaper]{...} In addition, if you are using latex+dvips, you may need to specify the a4 papersize on the dvips command line using the '-t' argument: dvips -t a4 InputFile.dvi -o OutputFile.ps if the default system setting is for letterpaper, which will likely be the case for U.S. based installs. a4 paper is 210 mm x 297 mm. There is a TeX FAQ here which might be helpful: http://www.tex.ac.uk/cgi-bin/texfaq2html HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] convolution of the double exponential distribution
Ravi, Duncan, and Matthias, Thank you very much for the helpful replies. For convolutions with 2 or 3 copies, I found that the CDFs from the distr package closely match the analytic results from this paper: K. Singh, M. Xie, and W. E. Strawderman, Combining Information From Independent Sources Through Confidence Distributions, Annals of Statistics 33, no. 1 (2005): 159-183. That gives me confidence that the package will also work well for higher copy numbers. At least for me, using the package is much more convenient than programming all the needed integrals into R. David ___ David R. Bickel http://davidbickel.com Research Scientist Pioneer Hi-Bred International (DuPont) Bioinformatics and Exploratory Research 7200 NW 62nd Ave.; PO Box 184 Johnston, IA 50131-0184 515-334-4739 Tel 515-334-4473 Fax [EMAIL PROTECTED], [EMAIL PROTECTED] | -Original Message- | From: Matthias Kohl [mailto:[EMAIL PROTECTED] | Sent: Friday, December 23, 2005 9:09 AM | To: Bickel, David | Cc: Duncan Murdoch; r-help@stat.math.ethz.ch | Subject: Re: [R] convolution of the double exponential distribution | | Duncan Murdoch schrieb: | | On 12/22/2005 7:56 PM, Bickel, David wrote: | | | Is there any R function that computes the convolution of the double | exponential distribution? | | If not, is there a good way to integrate ((q+x)^n)*exp(-2x) | over x from | 0 to Inf for any value of q and for any positive integer n? | I need to | perform the integration within a function with q and n as | arguments. The | function integrate() is giving me this message: | | evaluation of function gave a result of wrong length | | | | Under the substitution of y = q+x, that looks like a gamma integral. | The x = 0 to Inf range translates into y = q to Inf, so | you'll need an | incomplete gamma function, such as pgamma. Be careful to get the | constant multiplier right. | | Duncan Murdoch | | __ | R-help@stat.math.ethz.ch mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide! | http://www.R-project.org/posting-guide.html | | | | Hi, | | you can use our package distr. | | require(distr) | ## define double exponential distribution | loc - 0 # location parameter | sca - 1 # scale parameter | | rfun - function(n){ loc + scale * ifelse(runif(n) 0.5, 1, | -1) * rexp(n) } | body(rfun) - substitute({ loc + scale * ifelse(runif(n) | 0.5, 1, -1) * | rexp(n) }, | list(loc = loc, scale = sca)) | | dfun - function(x){ exp(-abs(x-loc)/scale)/(2*scale) } | body(dfun) - substitute({ exp(-abs(x-loc)/scale)/(2*scale) | }, list(loc | = loc, scale = sca)) | | pfun - function(x){ 0.5*(1 + | sign(x-loc)*(1-exp(-abs(x-loc)/scale))) } | body(pfun) - substitute({ 0.5*(1 + | sign(x-loc)*(1-exp(-abs(x-loc)/scale))) }, | list(loc = loc, scale = sca)) | | qfun - function(x){ loc - scale*sign(x-0.5)*log(1 - 2*abs(x-0.5)) } | body(qfun) - substitute({ loc - scale*sign(x-0.5)*log(1 - | 2*abs(x-0.5)) }, | list(loc = loc, scale = sca)) | | D1 - new(AbscontDistribution, r = rfun, d = dfun, p = | pfun, q = qfun) | plot(D1) | | D2 - D1 + D1 # convolution based on FFT | plot(D2) | | hth, | Matthias | | -- | StaMatS - Statistik + Mathematik Service | Dipl.Math.(Univ.) Matthias Kohl | www.stamats.de | This communication is for use by the intended recipient and ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot curves with more than 8 colors
Hi, Thanks for your kindly reply. I think maybe I didn't specify color codes properly. That is,the difference between each color is not sharp enough for me to identify them as different colors. So can you tell me about how to specify the color properly so that the difference among each color can be identified clearly? Thanks again and again ... On 12/27/05, Uwe Ligges [EMAIL PROTECTED] wrote: Vincent Deng wrote: Dear Uwe, Sorry, I did not describe my question clearly. I created a matrix to store color code using rgb function. abc = rgb(6:36,0,0,maxColorValue = 255) And after running codes like this for (i in c(1:20)) { points(...,...,col=abc[i]) lines(...,col=abc[i]) } R still used 8 colors of abc color codes repeatedly to draw the diagram Any helps? No, it does not (in fact, all appears to be more or less black on my screen ;-)). Another example: plot(1:255, col=rgb(1:255,0,0,maxColorValue = 255)) Uwe Ligges Best Regards... On 12/27/05, Uwe Ligges [EMAIL PROTECTED] wrote: Vincent Deng wrote: Hi, I'm a new hand in R language. I have about 20 groups of data[x,y] and want to plot them on a graph. To do this, I write a for-loop as following: (some codes are omitted for simplicity) for (i in c(1:20)) { points(...,...,col=i) lines(...,col=i) } The problem is R only plot them with 8 colors repeatly. Could anyone help me solve this problem? Or is there any package providing plot function without color limit? After typing ?colors I get a nice help page that points me to a lot of other functions that generate more than 8 colors. Maybe your installation of R is broken and you cannot see this help page? You certainly tried to get help on colors as well. There is no limit of the color number in the functions above, simply specify the color you want to get. The only color limit applies for the device and for most devices and rgb colors this is 256^3. Uwe Ligges Best Regards... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Regression with partial info about the dependent variable
Hi, I have the following problem which I would appreciate some help on. A variable y is to be modelled as a function of a set of variables Vector(x). The twist is that there is another variable z in the problem with the property that y(i) = z(i). So the data set is divided into three categories I.y(i) = z(i) II. Both y(i) and z(i) are known and y(i) z(i) III. y(i) is not known but z(i) is known ( But y(i) is guaranteed to be z(i) ) The data in categories I + II can be satisfactorily modelled via a OLS regression of the form: y ~ Vec(x) The question is how to incorporate the information contained in the category III data? The category II data can be used to construct a model for y given z. Indeed log(z(i)-y(i)) is reasonably normal and so the following is a decent approximation: y(i) = z(i) + A*exp( N(0,1) ) This model can be improved by including Vec(x). After this I am not sure how to proceed :-( :-( Thanks in advance, Maneesh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to plot curves with more than 8 colors
It might be hard to differentiate between each color with having 255 of them. Here is an example of using ColorRampPalette to create a set of colors. You can experiment with as many differing ones as you want to to get the difference that you want: # use 5 colors to create a sequence (you can add more colors if you want to) f.c - colorRampPalette(c('red','green','orange','blue','yellow'))(255) plot(0,type='n', ylim=c(0,255), xlim=c(0,1)) for (i in 1:255) segments(0, i, 1, i, col=f.c[i]) On 12/27/05, Vincent Deng [EMAIL PROTECTED] wrote: Hi, Thanks for your kindly reply. I think maybe I didn't specify color codes properly. That is,the difference between each color is not sharp enough for me to identify them as different colors. So can you tell me about how to specify the color properly so that the difference among each color can be identified clearly? Thanks again and again ... On 12/27/05, Uwe Ligges [EMAIL PROTECTED] wrote: Vincent Deng wrote: Dear Uwe, Sorry, I did not describe my question clearly. I created a matrix to store color code using rgb function. abc = rgb(6:36,0,0,maxColorValue = 255) And after running codes like this for (i in c(1:20)) { points(...,...,col=abc[i]) lines(...,col=abc[i]) } R still used 8 colors of abc color codes repeatedly to draw the diagram Any helps? No, it does not (in fact, all appears to be more or less black on my screen ;-)). Another example: plot(1:255, col=rgb(1:255,0,0,maxColorValue = 255)) Uwe Ligges Best Regards... On 12/27/05, Uwe Ligges [EMAIL PROTECTED] wrote: Vincent Deng wrote: Hi, I'm a new hand in R language. I have about 20 groups of data[x,y] and want to plot them on a graph. To do this, I write a for-loop as following: (some codes are omitted for simplicity) for (i in c(1:20)) { points(...,...,col=i) lines(...,col=i) } The problem is R only plot them with 8 colors repeatly. Could anyone help me solve this problem? Or is there any package providing plot function without color limit? After typing ?colors I get a nice help page that points me to a lot of other functions that generate more than 8 colors. Maybe your installation of R is broken and you cannot see this help page? You certainly tried to get help on colors as well. There is no limit of the color number in the functions above, simply specify the color you want to get. The only color limit applies for the device and for most devices and rgb colors this is 256^3. Uwe Ligges Best Regards... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 247 0281 What the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R on Mandriva 2006
Hello anyone, I'm trying to install R on Mandriva 2006 distribution via rpm file with the line urpmi R-2.0.0-1mdk.i586.rpm but I got an error message saying that the file is not accessible due to some info problem. I also tried with a source code in R-2.1.1.tar but I think that there is some problem concerning the new version of gcc (4.x), so I downgraded it to gcc 3.4.5 but it does not work either. Could anyone help me with this installation, please? Thanks, Paolo -- Paolo Bulla Istituto di Metodi Quantitativi Università L. Bocconi Tel. +39 02.5836.5651 viale Isonzo 25 20136 Milano [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Importing Genstat files into R
Does anyone know if there is a package or other method of reading Genstat files directly into R. Genstat isn't listed in the foreign package. Many thanks, Graham [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html