Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
ansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] For help in R coding If I understand correctly, you want to keep the rows from each table which have common values in the second column. In which case, merge will work for this, such as in this example. Say you have these data frames: > fra

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
__ From: ONKELINX, Thierry [thierry.onkel...@inbo.be] Sent: Tuesday, July 05, 2011 3:53 PM To: Bansal, Vikas; David Winsemius Cc: r-help@r-project.org Subject: RE: [R] For help in R coding Dear Vikas, Have at look at ?merge() Best regards, Thierry > -Oorspronkelijk bericht--

Re: [R] For help in R coding

2011-07-05 Thread Adrienne Wootten
bo.be] > Sent: Tuesday, July 05, 2011 3:53 PM > To: Bansal, Vikas; David Winsemius > Cc: r-help@r-project.org > Subject: RE: [R] For help in R coding > > Dear Vikas, > > Have at look at ?merge() > > Best regards, > > Thierry > >> -Oorspronkelijk bericht-

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
From: ONKELINX, Thierry [thierry.onkel...@inbo.be] Sent: Tuesday, July 05, 2011 3:53 PM To: Bansal, Vikas; David Winsemius Cc: r-help@r-project.org Subject: RE: [R] For help in R coding Dear Vikas, Have at look at ?merge() Best regards, Thierry > -Oorspronkelijk bericht- >

Re: [R] For help in R coding

2011-07-05 Thread ONKELINX, Thierry
ct.org > Onderwerp: Re: [R] For help in R coding > > Dear all, > > I have one problem and did not find any solution.Please I want your help. > > I have two data frames and I want to concatenate them.But the thing is- > > two data frames are like this- > > V1

Re: [R] For help in R coding

2011-07-05 Thread Bansal, Vikas
: Bansal, Vikas Cc: Dennis Murphy; r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 3, 2011, at 6:10 PM, Bansal, Vikas wrote: > > > From: David Winsemius [dwinsem...@comcast.net] > Sent: Sunday, July 03, 2011 7:08 PM >&g

Re: [R] For help in R coding

2011-07-04 Thread David Winsemius
__ From: David Winsemius [dwinsem...@comcast.net] Sent: Monday, July 04, 2011 2:02 AM To: Bansal, Vikas Cc: Dennis Murphy; r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 3, 2011, at 6:10 PM, Bansal, Vikas wrote: So I want to code so that it will give the output like this-

Re: [R] For help in R coding

2011-07-04 Thread Bansal, Vikas
-project.org Subject: Re: [R] For help in R coding On Jul 3, 2011, at 6:10 PM, Bansal, Vikas wrote: >> So I want to code so that it will give the output like this- >> >> DATA FRAME (Input) Editing the task so it is reproducible: dat <- read.table(textConnection(' col3

Re: [R] For help in R coding

2011-07-03 Thread David Winsemius
On Jul 3, 2011, at 6:10 PM, Bansal, Vikas wrote: So I want to code so that it will give the output like this- DATA FRAME (Input) Editing the task so it is reproducible: dat <- read.table(textConnection(' col3 col9 T .a,g,, A.t,t,,

Re: [R] For help in R coding

2011-07-03 Thread David Winsemius
On Jul 3, 2011, at 6:10 PM, Bansal, Vikas wrote: From: David Winsemius [dwinsem...@comcast.net] Sent: Sunday, July 03, 2011 7:08 PM the code is same i just want to add a condition so that it should check that if in column 3, the character is A

Re: [R] For help in R coding

2011-07-03 Thread Daniel Malter
Say you have the string x in a matrix x<-c('a,..gGGtTaachttp://r.789695.n4.nabble.com/For-help-in-R-coding-tp3639413p3642655.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] For help in R coding

2011-07-03 Thread Bansal, Vikas
From: David Winsemius [dwinsem...@comcast.net] Sent: Sunday, July 03, 2011 7:08 PM To: Bansal, Vikas Cc: Dennis Murphy; r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 3, 2011, at 1:07 PM, Bansal, Vikas wrote: > Yes you are ri

Re: [R] For help in R coding

2011-07-03 Thread David Winsemius
is the output for first five rows. Can you please help me how to use this if condition in your coding or we can also do it by using some other condition rather than if condition? From: David Winsemius [dwinsem...@comcast.net] Sent: Sunday,

Re: [R] For help in R coding

2011-07-03 Thread Bansal, Vikas
rather than if condition? ________ From: David Winsemius [dwinsem...@comcast.net] Sent: Sunday, July 03, 2011 3:57 AM To: Bansal, Vikas Cc: Dennis Murphy; r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 2, 2011, at 4:46 PM, Bansa

Re: [R] For help in R coding

2011-07-03 Thread David Winsemius
able to check my guesses against you full specifications. -- David. Can you please help me how to use this if condition in your coding or we can also do it by using some other condition rather than if condition? ________ From: David Winsemiu

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
_ From: David Winsemius [dwinsem...@comcast.net] Sent: Saturday, July 02, 2011 9:04 PM To: Dennis Murphy Cc: r-help@r-project.org; Bansal, Vikas Subject: Re: [R] For help in R coding On reflection and a bit of testing I think the best approach would be to use gregexpr. For counting the numb

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
__ From: Dennis Murphy [djmu...@gmail.com] Sent: Saturday, July 02, 2011 8:22 PM To: r-help@r-project.org Cc: Bansal, Vikas; David Winsemius Subject: Re: [R] For help in R coding Hi: There seems to be a problem if the string ends in , or . , which makes it

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London From: David Winsemius [dwinsem...@comcast.net] Sent: Saturday, July 02, 2011 6:19 PM To: Bansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 2

Re: [R] For help in R coding

2011-07-02 Thread David Winsemius
on returns a vector. (It doesn't hurt, but it is unnecessary.) Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London From: David Winsemius [dwinsem...@comcast.net] Sent: Saturday, July 02, 2011 9:04 PM To: Dennis Murphy Cc:

Re: [R] For help in R coding

2011-07-02 Thread David Winsemius
On reflection and a bit of testing I think the best approach would be to use gregexpr. For counting the number of commas, this appears quite straightforward. > sapply(gregexpr("\\,", txtvec), function(x) if ( x[[1]] != -1) length(x) else 0 ) [1] 3 3 3 4 3 3 2 6 4 6 6 It easily generalize

Re: [R] For help in R coding

2011-07-02 Thread Dennis Murphy
Hi: There seems to be a problem if the string ends in , or . , which makes it difficult for strsplit() to pick up if it is splitting on those characters. Here is an alternative, splitting on individual characters and using charmatch() instead: charsum <- function(s, char) { u <- strsplit(s, "

Re: [R] For help in R coding

2011-07-02 Thread Bansal, Vikas
>> Dear all, >> >> I am doing a project on variant calling using R.I am working on >> pileup file.There are 10 columns in my data frame and I want to >> count the number of A,C,G and T in each row for column 9.example of >> column 9 is given below- >> >> .a,g,, >> .t,t,, >>

Re: [R] For help in R coding

2011-07-02 Thread David Winsemius
On Jul 2, 2011, at 12:34 PM, Bansal, Vikas wrote: Dear all, I am doing a project on variant calling using R.I am working on pileup file.There are 10 columns in my data frame and I want to count the number of A,C,G and T in each row for column 9.example of column 9 is given below-

Re: [R] For help in R coding

2011-07-01 Thread Bansal, Vikas
ege London ____________ From: David Winsemius [dwinsem...@comcast.net] Sent: Saturday, July 02, 2011 2:07 AM To: Bansal, Vikas Subject: Re: [R] For help in R coding On Jul 1, 2011, at 8:01 PM, Bansal, Vikas wrote: > Dear David, > > Thanks for your reply.I tri

[R] For help in R coding

2011-07-01 Thread Bansal, Vikas
_ From: David Winsemius [dwinsem...@comcast.net] Sent: Friday, July 01, 2011 11:25 PM To: Bansal, Vikas Cc: r-help@r-project.org Subject: Re: [R] For help in R coding On Jul 1, 2011, at 12:47 PM, Bansal, Vikas wrote: > Dear all, > > I am doing a project on variant calling using R.I am wor

Re: [R] For help in R coding

2011-07-01 Thread David Winsemius
ollege London ________________ From: David Winsemius [dwinsem...@comcast.net] Sent: Saturday, July 02, 2011 2:07 AM To: Bansal, Vikas Subject: Re: [R] For help in R coding On Jul 1, 2011, at 8:01 PM, Bansal, Vikas wrote: Dear David, Thanks for your reply.I tried your cod

Re: [R] For help in R coding

2011-07-01 Thread Gabor Grothendieck
On Fri, Jul 1, 2011 at 12:47 PM, Bansal, Vikas wrote: > Dear all, > > I am doing a project on variant calling using R.I am working on pileup > file.There are 10 columns in my data frame and I want to count the number of > A,C,G and T in each row for column 9.example of column 9 is given below- >

Re: [R] For help in R coding

2011-07-01 Thread David Winsemius
On Jul 1, 2011, at 12:47 PM, Bansal, Vikas wrote: Dear all, I am doing a project on variant calling using R.I am working on pileup file.There are 10 columns in my data frame and I want to count the number of A,C,G and T in each row for column 9.example of column 9 is given below-

[R] For help in R coding

2011-07-01 Thread Bansal, Vikas
Dear all, I am doing a project on variant calling using R.I am working on pileup file.There are 10 columns in my data frame and I want to count the number of A,C,G and T in each row for column 9.example of column 9 is given below- .a,g,, .t,t,, .,c,c,