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
> -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
> -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
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,
>
> #
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
>
>> 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
>
>
>
>
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
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
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),
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
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
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
"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
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
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
15 matches
Mail list logo