Re: [R] remove low frequent rows

2008-08-31 Thread Jorge Ivan Velez
Dear jayuan2008, See ?subset. If I understand your description below, something like this could do the job: a1-data.frame(x=c(a,b,a,b,a),y=c(4,3,6,1,2)) subset(a1,y2) x y 1 a 4 2 b 3 3 a 6 BTW, I think that the final result you described in your post is incorrect. HTH, Jorge On Sun, Aug

Re: [R] remove low frequent rows

2008-08-31 Thread markleeds
DF-cbind(c(a,b,a),c(4,3,6)) DF[(DF[,1] %in% names(which(table(DF[,1]) = 2))),] On Sun, Aug 31, 2008 at 2:19 AM, Yuan Jian wrote: Hi, � I have a matrix. a-cbind(c(a,b,a),c(4,3,6)) [,1] [,2] [1,] a� 4 [2,] b� 3 [3,] a� 6 I want to remove rows in matrix a whose first column has

Re: [R] remove low frequent rows

2008-08-31 Thread Gabor Grothendieck
See ?ave and try this: a[as.numeric(ave(a[,1], a[,1], FUN = length)) 1, ] On Sun, Aug 31, 2008 at 2:19 AM, Yuan Jian [EMAIL PROTECTED] wrote: Hi, I have a matrix. a-cbind(c(a,b,a),c(4,3,6)) [,1] [,2] [1,] a 4 [2,] b 3 [3,] a 6 I want to remove rows in matrix a whose first

[R] give all combinations

2008-08-31 Thread Yuan Jian
Hello,   is there a simple way to give all combinations for a given vector:   v-c(a,b,c)   combination(v,v) becomes aa,ab,ac,bb,bc,cc'   combination(v,v,v) becomes aaa,aab,aac,abb,..     [[alternative HTML version deleted]] __

[R] Avoiding factors and levels in data frames

2008-08-31 Thread Asher Meir
Hello all. I am an experienced R user, I have used R for many years for a wide variety of applications. However, I keep on running into one obstacle: I never want factors or levels in my data frames, but I keep on getting them. Is there any way to globally turn this whole feature of data frames

Re: [R] give all combinations

2008-08-31 Thread Lucien Lemmens
Yuan Jian jayuan2008 at yahoo.com writes: Hello,   is there a simple way to give all combinations for a given vector:   v-c(a,b,c)   combination(v,v) becomes aa,ab,ac,bb,bc,cc'   combination(v,v,v) becomes aaa,aab,aac,abb,..   vv-c(outer(v,v,paste)) vv [1] a a b a c a a b b b c

Re: [R] Avoiding factors and levels in data frames

2008-08-31 Thread Patrick Connolly
On Sun, 31-Aug-2008 at 12:01PM +0300, Asher Meir wrote: | Hello all. | | I am an experienced R user, I have used R for many years for a wide | variety of applications. However, I keep on running into one obstacle: | I never want factors or levels in my data frames, but I keep on | getting them.

Re: [R] give all combinations

2008-08-31 Thread Peter Dalgaard
Lucien Lemmens wrote: Yuan Jian jayuan2008 at yahoo.com writes: Hello, is there a simple way to give all combinations for a given vector: v-c(a,b,c) combination(v,v) becomes aa,ab,ac,bb,bc,cc' combination(v,v,v) becomes aaa,aab,aac,abb,.. vv-c(outer(v,v,paste)) vv [1]

Re: [R] give all combinations

2008-08-31 Thread baptiste auguie
I had a similar problem recently where I used the following code: v - factor(letters[1:3]) all.cases - expand.grid(v, v) all.cases[as.numeric(all.cases[, 2]) = as.numeric(all.cases[, 1]), ] I'm not sure how to extend it cleanly to an arbitrary number of vectors, though. Baptiste On 31

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in C, the following sentences are used.   for i = 1 to 3     for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc    --- On Sun, 8/31/08, Lucien Lemmens [EMAIL

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in C, the following sentences are used.   for i = 1 to 3       for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc    --- On Sun, 8/31/08, Lucien Lemmens [EMAIL

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in C, the following sentences are used.   for i = 1 to 3      for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc    --- On Sun, 8/31/08, Lucien Lemmens [EMAIL

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in other computer language, the following sentences are used.   for i = 1 to 3     for j = i+1 to 3       for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc   

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in other computer language, the following sentences are used.   for i = 1 to 3     for j = i+1 to 3      for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc   

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in other computer language, the following sentences are used.   for i = 1 to 3     for j = i+1 to 3     for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc    --- On

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in other computer language, the following sentences are used.   for i = 1 to 3     for j = i+1 to 3   for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc   

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks.   how to remove the combinations that has same ingredients: in C, the following sentences are used.   for i = 1 to 3     for a b a, a a b and b a a, only one of them is kept, others are remove.   v-c(a,b,c) v v should be aa, ab, ac, bc    --- On Sun, 8/31/08, Lucien Lemmens [EMAIL

Re: [R] give all combinations

2008-08-31 Thread Yuan Jian
thanks. how to remove the combinations that has same ingredients: v-c(a,b,c) v.v becomes ab, ac, bc (aa,bb,cc are removed) v.v.v becomes abc (aaa,aab,... are removed, because they have same ingredients)   that is.  the following sentences can be used.   for(i in 1:3){     for (j in i+1:3){    

[R] Fitted probabilities in conditional logit regression

2008-08-31 Thread Min Chen
Dear R-help, I'm doing conditional logit regression for a discrete choice model. I want to know whether there's a way to get the fitted probabilities. In Stata, predict works for clogit, but it seems that in R predict does not. Thank you very much! Best wishes.

Re: [R] give all combinations

2008-08-31 Thread Lucien Lemmens
Another solution requiring also a bit of programming is: l-letters[1:3] c2-c() for(i in 1:3){c2-c(c2,paste(letters[i],letters[i:3],sep=))} c2 [1] aa ab ac bb bc cc n-length(c2) c3-c();for(i in 1:n){c3-c(c3,paste(c2[i],letters[ceiling(i/2):3],sep=))} c3 [1] aaa aab aac aba abb abc acb

Re: [R] cex.axis for the x axis

2008-08-31 Thread Pavel77
Thanks Mark, I was hoping I wouldn't have to annotate axes individually but have been able to work through it with your direction. Pavel. -- View this message in context: http://www.nabble.com/cex.axis-for-the-x-axis-tp18353453p19241307.html Sent from the R help mailing list archive at

[R] a question about minimization of two functions

2008-08-31 Thread farhad reza
if (typeof YAHOO == undefined) { var YAHOO = {}; } YAHOO.Shortcuts = YAHOO.Shortcuts || {}; YAHOO.Shortcuts.hasSensitiveText = false; YAHOO.Shortcuts.sensitivityType = []; YAHOO.Shortcuts.doUlt = false; YAHOO.Shortcuts.location = us; YAHOO.Shortcuts.document_id = 0;

[R] Parenthesis recognition with grep

2008-08-31 Thread Sébastien
Dear R-users, I need to dynamically recognize the index of a given string myStr in a vector of string. The problem is that myStr might contain parenthesis, causing grep not to recognize it the way I want (see below). The help mentions that the pattern used by grep should be in the POSIX

Re: [R] Unable to send color palette through plot.Design to method=image

2008-08-31 Thread Frank E Harrell Jr
David Winsemius wrote: I have been trying to specify a different color palette to the image method in plot.Design. My model has crossed two rcs() arguments and one two-level gender argument. The goal which appears to have been mostly achieved is to produce separate bivariate plots for men

Re: [R] Parenthesis recognition with grep

2008-08-31 Thread Jorge Ivan Velez
Dear Sébastien, Is this what you want? which(myStr==headers) [1] 2 which(headers%in%myStr) [1] 2 HTH, Jorge On Sun, Aug 31, 2008 at 10:28 AM, Sébastien [EMAIL PROTECTED] wrote: Dear R-users, I need to dynamically recognize the index of a given string myStr in a vector of string. The

Re: [R] Non-numeric argument to fft

2008-08-31 Thread Uwe Ligges
[EMAIL PROTECTED] wrote: If this is the case then how to I take a list of numbers (residuals in this case) and create anothe list that is longer and padded by zeros? Maybe fft already does this for me but as I understood it I need to pass an vector to the fft that is of a power of 2 length.

Re: [R] Parenthesis recognition with grep

2008-08-31 Thread Sébastien
Hi Jorge, This is doing the work just fine. Thank you ! However, I would like to know what should be done with the grep call... just for my personal education :) Sebastien Jorge Ivan Velez a écrit : Dear Sébastien, Is this what you want? which(myStr==headers) [1] 2

Re: [R] Parenthesis recognition with grep

2008-08-31 Thread Charilaos Skiadas
Try: myStr - YD\\(001\\) In POSIX format, or in most such formats in fact, special characters like parentheses have a particular meaning, and need to be escaped if they are to have the parenthesis meaning. This is done typically by putting a backslash in front of them. Since however a

Re: [R] lm() and dffits

2008-08-31 Thread Dieter Menne
Ranney, Steven steven.ranney at montana.edu writes: 1) fit a simple lm(LW~LL) 2) calculate the dffits for those data points 3) remove those data points that are 2*sqrt(p/n) (where p=the number of parameters and n=number of data points; p=3 in a linear model, correct? Intercept, slope, and

[R] How to do parallel computation?

2008-08-31 Thread ZT2008
Is it possible to do parallel computation in R? How? -- View this message in context: http://www.nabble.com/How-to-do-parallel-computation--tp19244438p19244438.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] How to do parallel computation?

2008-08-31 Thread Dirk Eddelbuettel
On 31 August 2008 at 10:53, ZT2008 wrote: | Is it possible to do parallel computation in R? Yes. | How? MPI, PVM, NWS, Snow, ... You could have a look at the slides from my introductory tutorial at useR! earlier this months. About one-third of the material was about parallel computing

[R] error instead of warning?

2008-08-31 Thread ivo welch
dear R experts---is it possible to ask R to abort with an error instead of just giving a warning when I am mis-assigning vectors (or other data structures) that are not compatible? that is, I would like 1: In matrix(value, n, p) ... : data length [12] is not a sub-multiple or multiple of the

[R] tryCatch

2008-08-31 Thread Redding, Matthew
Hi All R-Gurus, I am trying to debug a program, and I think tryCatch will help. The functions involved process through so many times before I encounter the error, things are a bit slow to use debug and browser(). I've read the help file and postings on conditions, and am still having

[R] Error with Rcmdr package

2008-08-31 Thread Nguyen Dinh Nguyen
Dear all, A friend of mine, who just installed Rcmdr package. When calling the package, the error as following comes up. And actually, I've checked in CRAN packages, the tcltk package doesn't exist anymore, but tcltk2. Any help is appreciated Regards Nguyen D Nguyen Garvan Institute of Medical

Re: [R] error instead of warning?

2008-08-31 Thread Duncan Murdoch
ivo welch wrote: dear R experts---is it possible to ask R to abort with an error instead of just giving a warning when I am mis-assigning vectors (or other data structures) that are not compatible? that is, I would like 1: In matrix(value, n, p) ... : data length [12] is not a sub-multiple

[R] reading data in serial port - win32

2008-08-31 Thread Cleber Nogueira Borges
Hello all I'd like to get some instruments data by serial port (COM1 - win32) I make a loopback serial adapter for a testing with the code: system('mode COM1 9600,N,8,1') ser - file(COM1, open='r+') isOpen(ser) write('12345', ser) scan(ser, what=as.character(1), n=1) So I get the data that I

[R] how to draw a perspective pyramid

2008-08-31 Thread dxc13
Dear list, I am trying to construct a perspective plot of a 2D triangle, or pyramid. I can easily do the one dimensional plot (code below), but I can't figure out how to do it in a perspective plot for two input variables. Does anyone have a simple solution? Thanks! Derek #code for a

Re: [R] SQL Primer for R

2008-08-31 Thread ivo welch
stumped again by SQL... If I have a table named main in an SQLite data base, how do I get the names of all its columns? (I have a mysql book that claims the SHOW command does this sort of thing, but it does not seem to work on SQLite.) regards, /iaw PS: Thanks for the earlier emails on

Re: [R] how to draw a perspective pyramid

2008-08-31 Thread David Winsemius
On Aug 31, 2008, at 7:21 PM, dxc13 wrote: Dear list, I am trying to construct a perspective plot of a 2D triangle, or pyramid. I can easily do the one dimensional plot (code below), but I can't figure out how to do it in a perspective plot for two input variables. Does anyone have a

[R] why isoMDS not found?

2008-08-31 Thread 陈武
When I type isoMDS() in the R environment, a error shows up: no such function isoMDS. Why? And what should I do to use isoMDS? Additionally, I cannot install add-on packages. Typing Rcmd.exe INSTALL e:/VR_7.2-44.zip results in 'perl' is neither command nor executable file Why this

Re: [R] SQL Primer for R

2008-08-31 Thread Gabor Grothendieck
On Sun, Aug 31, 2008 at 9:29 PM, ivo welch [EMAIL PROTECTED] wrote: stumped again by SQL... If I have a table named main in an SQLite data base, how do I get the names of all its columns? (I have a mysql book that claims the SHOW command does this sort of thing, but it does not seem to work

Re: [R] why isoMDS not found?

2008-08-31 Thread Jorge Ivan Velez
Hi there, You must load the MASS package first, i.e, library(MASS) ?isoMDS HTH, Jorge On Sun, Aug 31, 2008 at 10:14 PM, ³ÂÎä [EMAIL PROTECTED] wrote: When I type isoMDS() in the R environment, a error shows up: no such function isoMDS. Why? And what should I do to use isoMDS?

[R] Help with stl

2008-08-31 Thread rkevinburton
I just realized after some tips and a little digging that what I was trying to do manually has already been done. I was trying to fit my data using 'lm' then taking the residual data and trying to do a spectral estimate (for seasonality) usiing fft and then passing the residual of all of that