Re: [R] tapply syntax

2010-03-28 Thread Jeff Brown
What is the function set()? Is that a typo? When I type ?set I get nothing, and when I try to evaluate that code R tells me it can't find the function. -- View this message in context: http://n4.nabble.com/tapply-syntax-tp1692503p1694586.html Sent from the R help mailing list archive at

Re: [R] tapply syntax

2010-03-28 Thread Rolf Turner
On 29/03/2010, at 1:27 PM, Jeff Brown wrote: What is the function set()? Is that a typo? When I type ?set I get nothing, and when I try to evaluate that code R tells me it can't find the function. Yeah, it's a typo. (S)he meant ``subset''. cheers, Rolf Turner

Re: [R] tapply syntax

2010-03-28 Thread jim holtman
The message tells you everything - there is no function 'set' in the workspace you are using. Did you forget to load a library? What is the context in which you are trying to use it? On Sun, Mar 28, 2010 at 8:27 PM, Jeff Brown dopethatwantsc...@yahoo.comwrote: What is the function set()? Is

Re: [R] tapply syntax

2010-03-28 Thread David Freedman
sorry - I use many abbreviations and I try to remove them before I post questions/answers - 'set' is my abb. for subset david On 3/28/2010 8:27 PM, Jeff Brown [via R] wrote: What is the function set()? Is that a typo? When I type ?set I get nothing, and when I try to evaluate that code R

[R] tapply syntax

2010-03-26 Thread Min-Han Tan
Dear R-help members, Apologies for the trouble. I have a question : Essentially, I have a dataset which stores genetic variations for individual patients. Each individual patient can have more than one variation, and each new record corresponds to a new variation (thus, both individual patients

Re: [R] tapply syntax

2010-03-26 Thread Min-Han Tan
Hi, I figured a workaround to my problem, but if anyone has any advice on how to express a function in tapply to achieve the same outcome, that would be awesome and I'd learn something about functions! The workaround was tapply ((data$Variation.Type %in% c(2,3)), data$Patient, sum) Thanks.

Re: [R] tapply syntax

2010-03-26 Thread David Freedman
how about: d1=data.frame(pat=c(rep('a',3),'b','c',rep('d',2),rep('e',2),'f'),var=c(1,2,3,1,2,2,3,2,4,4)) ds=set(d1,var %in% c(2,3)) with(ds,tapply(var,pat,FUN=length)) hth, David Freedman, CDC, Atlanta -- View this message in context: http://n4.nabble.com/tapply-syntax-tp1692503p1692553.html