Re: [R] How to combine matrices?

2009-09-22 Thread Zhiliang Ma
rbind(a, b, c) another function you might be interested in is cbind. cheers, On Tue, Sep 22, 2009 at 9:40 AM, FMH kagba2...@yahoo.com wrote: Dear All, Let a, b and c are three matrices with same no. of column but different no. of row. a - matrix(1, 1, 2) b - matrix(2, 2, 2) c -

Re: [R] Best R text editors?

2009-08-29 Thread Zhiliang Ma
Emacs + ESS On Thu, Aug 27, 2009 at 12:43 PM, Jonathan Greenberggreenb...@ucdavis.edu wrote: Quick informal poll: what is everyone's favorite text editor for working with R?  I'd like to hear from people who are using editors that have some level of direct R interface (e.g. Tinn-R,

Re: [R] Simulation Function - Save results

2009-08-15 Thread Zhiliang Ma
in order to return more multiple variables, you can put them in a list and then return this list. e.g. #Function A boot-function(a,b,c){ mean_boot-(a+b)/2 var_boot-c list(mean_boot = mean_boot, var_boot = var_boot) } out - boot(1,2,3) out $mean_boot [1] 1.5 $var_boot [1] 3 On Fri, Aug 14,

Re: [R] overlap two graph

2009-08-11 Thread Zhiliang Ma
plot(allPoints, col=c(rep(2,201), rep(3,201))) On Mon, Aug 10, 2009 at 9:54 PM, Hemavathi Ramuluhema.ram...@gmail.com wrote: Hi everyone, I'm stuck again, need you all help. I managed to  plot the diagram using allPoints-rbind(ellipsePoints(2,5, alpha = 30),ellipsePoints(2,5, alpha = 60))

[R] help on Rmpi

2009-08-11 Thread Zhiliang Ma
Dear R Users, I'm using Rmpi package for paralleling computing. It's very useful. But I have two question: 1. before running processes on slaves, all the data should be sent to them. however, if i forget to broadcast some of the data, the master will freeze, and I have to kill the process

Re: [R] Saving plots to file

2009-08-10 Thread Zhiliang Ma
?postscript ?pdf On Mon, Aug 10, 2009 at 9:25 AM, Sean MacEachernsean.mace...@gmail.com wrote: Appologies if this has been addressed before, but I can't seem to find it in the help archives. I'm looking to do something like the following but it looks like save.plot is deprecated.

Re: [R] label X-Axis by abother variable in R plot

2009-08-09 Thread Zhiliang Ma
plot(b, c, xaxt=n) axis(1, at=b, labels=as.character(a)) On Sun, Aug 9, 2009 at 9:33 PM, Frank Zhangfrankyuzh...@yahoo.com wrote: Hi, I would like to plot b, c in one plot, and use a as x-aix. How could I do that? Thanks a,   b, c, 20, 2, 3 21, 4, 5 22, 1, 2 24, 3, 5 50, 3, 6

Re: [R] more than one mathematical annotation into a legend

2009-07-09 Thread Zhiliang Ma
On Thu, Jul 9, 2009 at 9:39 AM, Thomas Roth (geb. Kaliwe)hamstersqu...@web.de wrote: try this: legend(4,4, expression(t[m] == x, t[n] == x)) cheers, Zhiliang Dear members, Is there a way to put more than one mathematical annotation into a legend together with a calculated value? x = 2

Re: [R] Unix commands on R

2009-07-08 Thread Zhiliang Ma
?system On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuruduvvuru.su...@gmail.com wrote: I am using R on unix. While in R how do I execute the unix shell commands? Is there a way to do it? I am executing a function in R and the matrix resulting from the function has to be passed on as an input to

Re: [R] Two-way ANOVA gives different results using anova(lm()) than doing it by hand

2009-07-08 Thread Zhiliang Ma
the following works. i don't exactly what happens here. I guess lm might treat S1 and S2 as quantitative variables, not qualitative variables. cheers, Zhiliang S1 - as.character(Data[,1]) S1 - as.factor(S1) S2 - as.character(Data[,2]) S2 - as.factor(S2) data - data.frame(S1=S1, S2=S2,

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Zhiliang Ma
how about sum(!is.na(x)) ? On Tue, Jul 7, 2009 at 2:56 PM, Godmar Backgod...@gmail.com wrote: Hi, is there a simpler way to count the number of elements in a vector that are not NA than this: countN - function (v) {    return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1))) } ?