-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
-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 for the
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-project.org
Subject: Re: [R] Subseting a data.frame
May I ask why:
count_by_class - with(dat, ave
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
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
katherine_go...@yahoo.comwrote:
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
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 =
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
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)
@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), Thus, there is only one default frequency
Spotfire, TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-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
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-project.org
Subject: Re: [R] Subseting a data.frame
May I ask why:
count_by_class - with(dat, ave(numeric(length(basel_
: Re: [R] Subseting a data.frame
May I ask why:
count_by_class - with(dat, ave(numeric(length(basel_
asset_class)), basel_asset_class, FUN=length))
should not be more simply done as:
count_by_class - with(dat, ave(basel_asset_class, basel_asset_class,
FUN=length))
?
-- Bert
[mailto:gunter.ber...@gene.com]
Sent: Thursday, October 17, 2013 1:06 PM
To: William Dunlap
Cc: Katherine Gobin; r-help@r-project.org
Subject: Re: [R] Subseting a data.frame
May I ask why:
count_by_class - with(dat, ave(numeric(length(basel_
asset_class)), basel_asset_class, FUN=length))
should not be more
, 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,
#seq_along() worked in the cases you showed
15 matches
Mail list logo