vel, NA generated
>
> 3: In `[<-.factor`(`*tmp*`, i, value = 1L) :
>
> invalid factor level, NA generated
>
> but x=integer(length(group)) works in all cases:
>
> > ave(integer(length(fac)), fac, FUN=length)
>
> [1] 3 1 3 3
>
> > ave(in
> -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
74 0.875
Bill Dunlap
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 Gun
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
55 10
#10 1991 c 67 18
#11 1992 c 34 24
#12 1993 c 53 35
A.K.
- Original Message -
From: Akhil dua
To: r-help@r-project.org
Cc:
Sent: Thursday, August 2, 2012 4:44 AM
Subject: [R] Subseting
Hi everyone
I have banking
data[!(data$Name %in% names), ]
then, and "names" having the 9 names you want to dismiss.
Also please reply to the list as well if you answer, otherwise others won't
know of the progress made.
On 02.08.2012, at 11:48, Akhil dua wrote:
> This is the only issue actually
> I dotn want to take the
data[data$Name %in% names, ]
should work then. You do know which 40 of your 49 banks you want, right?
put their names in the "names" variable above.
If you want random 40 banks you can do something like this:
allNames<-unique(data$Name)
names<-sample(allNames,40)
Does that help? You really aren
On 02.08.2012, at 10:44, Akhil dua wrote:
> Hi everyone
>
> I have banking data set in long format with 4 columns.One of these columns
> is bank name which consist of 49 banks and I want the data for only 40
> banks out of these 49
> so can anyone help me on how to get this 40 banks data
>
> My
Hi everyone
I have banking data set in long format with 4 columns.One of these columns
is bank name which consist of 49 banks and I want the data for only 40
banks out of these 49
so can anyone help me on how to get this 40 banks data
My data looks like
Year Name totalliabilties assets
1990 a
Hello,
> HI,
> this is my problem I want to subset this file df, using only unique
> df$exon printing the line once even if df$exon appear several times:
>
> unique(df$exon) will show me the unique exons
> If I try to print only the unique exon lines
> with df[unique(df$exon),] -this doesn't pr
Please always cc the list for archival/threading reasons.
Sort answer is that unique() gives the unique elements rather than something
you should subset by, like a set of logical indices or row numbers.
Note that in general unique(x) == x[!duplicated(x)] I'd imagine there are cases
where this
I believe you want the duplicated() function.
Michael
On Mar 2, 2012, at 10:19 AM, nathalie wrote:
> HI,
> this is my problem I want to subset this file df, using only unique df$exon
> printing the line once even if df$exon appear several times:
>
> unique(df$exon) will show me the unique e
HI,
this is my problem I want to subset this file df, using only unique
df$exon printing the line once even if df$exon appear several times:
unique(df$exon) will show me the unique exons
If I try to print only the unique exon lines
with df[unique(df$exon),] -this doesn't print only the unique
You can use grepl:
> dat<-data.frame(test=c("abc","cdf","dabc"))
> d<-subset(dat,grepl(test,"abc"))
> d
test
1 abc
3 dabc
On Mon, May 2, 2011 at 7:03 PM, Matevž PavliÄ wrote:
> Hi,
>
>
>
> Is it possible (i am sure it is) to subset data from a data.frame on the
> basis of SQL >LIKE< oper
egation:
d <- subset(dat, !grepl("abc", test))
Uwe Ligges
Thanks, m
From: Steven Kennedy [mailto:stevenkennedy2...@gmail.com]
Sent: Monday, May 02, 2011 11:30 AM
To: Matevž PavliÄ
Cc: r-help@r-project.org
Subject: Re: [R] subseting data
You can use grepl:
dat<-data
only the first element will be used
> d
test
1 abc
2 cdf
3 dabc
I can't seem to make it work. Also how would i use the grepl() to select only
those that are not like i.e. »GP«?
Thanks, m
From: Steven Kennedy [mailto:stevenkennedy2...@gmail.com]
Sent: Monday, May 02,
I wonder if grep() will help you?
Cheers
Andrew
On Mon, May 02, 2011 at 11:03:52AM +0200, Matev? Pavli? wrote:
> Hi,
>
>
>
> Is it possible (i am sure it is) to subset data from a data.frame on the
> basis of SQL >LIKE< operator. I.e., i would like to subset a data where only
> values w
Hi,
Is it possible (i am sure it is) to subset data from a data.frame on the basis
of SQL >LIKE< operator. I.e., i would like to subset a data where only values
which contains a string >GP< would be used?
Example:
Gp<-subset(DF, DF$USCS like >GP<)
This like of course is not wor
29 matches
Mail list logo