Re: [R] Subseting a data.frame

2013-10-18 Thread Katherine Gobin
          2 >    > mydat[count_by_class>1, ] # I think this is what you are asking for >      basel_asset_class defa_frequency >    2                8          0.250 >    3                8          0.375 >    4                8          0.500 >    5                74 

Re: [R] Subseting a data.frame

2013-10-18 Thread S Ellison
> -Original Message- > > mydat >   basel_asset_class defa_frequency > 1                 2          0.150 > 2                 8          0.070 > 3                 8          0.030 > 4                 8          0.001 > > > I need to get the subset of this data.frame where no of records f

Re: [R] Subseting a data.frame

2013-10-18 Thread S Ellison
> -Original Message- > ... the kindest guide I can give is to > read an Introduction to R (ships with R) or a R web tutorial of your choice No quibble with the advice, but it prompted me to look again at the R Intro. Interestingly, the Intro doesn't mention subset() at all; the subsetting

Re: [R] Subseting a data.frame

2013-10-17 Thread William Dunlap
tfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: arun [mailto:smartpink...@yahoo.com] > Sent: Thursday, October 17, 2013 2:33 PM > To: R help > Cc: William Dunlap; Bert Gunter > Subject: Re: [R] Subseting a data.frame > > Hi Bill, > > #

Re: [R] Subseting a data.frame

2013-10-17 Thread arun
FUN=length)   [1] 3 1 3 3   > ave(integer(length(char)), char, FUN=length)       [1] 3 1 3 3 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Thursday, October 17, 2013 1:06 PM To: William Dunlap Cc: Katherine Gobin; r-help@r-proj

Re: [R] Subseting a data.frame

2013-10-17 Thread Bert Gunter
> >> ave(integer(length(fac)), fac, FUN=length) > >[1] 3 1 3 3 > > > ave(integer(length(char)), char, FUN=length) > > [1] 3 1 3 3 > > > > Bill Dunlap > > Spotfire, TIBCO Software > > wdunlap tibco.com > > > >

Re: [R] Subseting a data.frame

2013-10-17 Thread William Dunlap
ngth(group)) works in all cases: > ave(integer(length(fac)), fac, FUN=length) [1] 3 1 3 3 > ave(integer(length(char)), char, FUN=length) [1] 3 1 3 3 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Thursday, Octob

Re: [R] Subseting a data.frame

2013-10-17 Thread Bert Gunter
elp-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf > > Of Katherine Gobin > > Sent: Thursday, October 17, 2013 11:05 AM > > To: Bert Gunter > > Cc: r-help@r-project.org > > Subject: Re: [R] Subseting a data.frame > > > &g

Re: [R] Subseting a data.frame

2013-10-17 Thread William Dunlap
ter > Cc: r-help@r-project.org > Subject: Re: [R] Subseting a data.frame > > Correction. (2nd para first three lines) > > Pl read following line > > What I need is to select only those records for which there are more than two > default > frequencies (defa_frequency),

Re: [R] Subseting a data.frame

2013-10-17 Thread arun
You may try: mydat[with(mydat,ave(seq_along(basel_asset_class),basel_asset_class,FUN=length)>2),] #  basel_asset_class defa_frequency #2 8  0.070 #3 8  0.030 #4 8  0.001 #or library(plyr) mydat[ddply(mydat,.(basel_asset_class

Re: [R] Subseting a data.frame

2013-10-17 Thread Katherine Gobin
Correction. (2nd para first three lines)   Pl read following line  What I need is to select only those records for which there are more than two default frequencies (defa_frequency), Thus, there is only one default frequency = 0.150 w.r.t basel_asset_class = 4 whereas there are default frequenci

Re: [R] Subseting a data.frame

2013-10-17 Thread Katherine Gobin
 I am sorry perhaps  was not able to put the question properly. I am not looking for the subset of the data.frame where the basel_asset_class is > 2. I do agree that would have been a basic requirement. Let me try to put the question again.  I have a data frame as  mydat = data.frame(basel_ass

Re: [R] Subseting a data.frame

2013-10-17 Thread Bert Gunter
"Kindly guide" ... This is a very basic question, so the kindest guide I can give is to read an Introduction to R (ships with R) or a R web tutorial of your choice so that you can learn how R works instead of posting to this list. Cheers, Bert On Wed, Oct 16, 2013 at 11:55 PM, Katherine Gobin

Re: [R] Subseting a data.frame

2013-10-17 Thread Charles Determan Jr
Katherine, There are multiple ways to do this and I highly recommend you look into a basic R manual or search the forums. One quick example would be: mysub <- subset(mydat, basel_asset_class > 2) Cheers, Charles On Thu, Oct 17, 2013 at 1:55 AM, Katherine Gobin wrote: > Dear Forum, > > I have

[R] Subseting a data.frame

2013-10-17 Thread Katherine Gobin
Dear Forum, I have a data frame as  mydat = data.frame(basel_asset_class = c(2, 8, 8 ,8), defa_frequency = c(0.15, 0.07, 0.03, 0.001)) > mydat   basel_asset_class defa_frequency 1                 2          0.150 2                 8          0.070 3                 8          0.030 4