Re: [R] create a new data frame after comparing two columns of the previous data frame

2011-06-28 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 28.06.2011 02:45:01:

 
 Right. You forgot the comma!

If you want to resolve this rather cryptic advice see

?[

Regards
Petr

 
 -- 
 David.
 
 On Jun 27, 2011, at 7:10 PM, Nanami wrote:
 
  it's a table; I read it from a file; I've tried to make it look 
  prettier:
 
  head(intra)
  chr   miRNA   start end   strand  ACC
  hsa_ID   region region_start region_end
  chr1 miRNA 1102484 1102578  +   ACC=MI342; ID=hsa- 
  mir-200b;
  exon  11024841102578
  chr1 miRNA 1103243 1103332  +   ACC=MI737; ID=hsa- 
  mir-200a;
  exon  11032431103332
  chr1 miRNA 1104385 1104467  +   ACC=MI0001641;  ID=hsa- 
  mir-429;
  exon  11043851104467
  chr1 miRNA 3044539 3044599  +   ACC=MI0015861; ID=hsa- 
  mir-4251;
  exon  30445393044599
  chr1 miRNA 3477260 3477354  -   ACC=MI0003556; ID=hsa- 
  mir-551a;
  exon  34772603477354
  chr1 miRNA 6489894 6489956  -   ACC=MI0015864; ID=hsa- 
  mir-4252;
  exon  64898946489956
 
 
  When I changed  with   I got this error:
 
  new - intra[(intra$start != intra$region_start )(intra$end !=
  intra$region_end)]
  Error in `[.data.frame`(intra, (intra$start != intra$region_start) 
  (intra$end !=  :
   undefined columns selected
 
  What I would like to do is to create a new table that only contains 
  the rows
  for which column start and region_start are not the same.
 
 
 
  --
  View this message in context: http://r.789695.n4.nabble.com/create-a-
 new-data-frame-after-comparing-two-columns-of-the-previous-data-frame-
 tp3628981p3629092.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 David Winsemius, MD
 West Hartford, CT
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] create a new data frame after comparing two columns of the previous data frame

2011-06-27 Thread jim holtman
Use  instead of 

On Mon, Jun 27, 2011 at 6:01 PM, Nanami 13
deconstructed.morn...@gmail.com wrote:
 Hi everyone,

 I am trying to find a way to filter a table; If I am given for example the
 following table:
 head(intra)
   chr miRNA   start     end strand              ACC             hsa_ID
 region region_start region_end   gene_id transcrip_id
 1 chr1 miRNA 1102484 1102578      + ACC=MI342; ID=hsa-mir-200b;
 exon      1102484    1102578 NR_029639    NR_029639
 2 chr1 miRNA 1103243 1103332      + ACC=MI737; ID=hsa-mir-200a;
 exon      1103243    1103332 NR_029834    NR_029834
 3 chr1 miRNA 1104385 1104467      + ACC=MI0001641;  ID=hsa-mir-429;
 exon      1104385    1104467 NR_029957    NR_029957
 4 chr1 miRNA 3044539 3044599      + ACC=MI0015861; ID=hsa-mir-4251;
 exon      3044539    3044599 NR_036215    NR_036215
 5 chr1 miRNA 3477260 3477354      - ACC=MI0003556; ID=hsa-mir-551a;
 exon      3477260    3477354 NR_030277    NR_030277
 6 chr1 miRNA 6489894 6489956      - ACC=MI0015864; ID=hsa-mir-4252;
 exon      6489894    6489956 NR_036218    NR_036218

 I would only like to keep in the table the rows that have intra$start !=
 intra$region_start and intra$end != intra$region_end.
 I've tried using this but I get the following error:


 intra- intra[(intra$start != intra$region_start )(intra$end !=
 intra$region_end)]
 head(intra)
 data frame with 0 columns and 6 rows

 Thank you,

 best,
 Nanami

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] create a new data frame after comparing two columns of the previous data frame

2011-06-27 Thread David Winsemius


On Jun 27, 2011, at 6:56 PM, jim holtman wrote:


Use  instead of 



Yes, and don't forget the comma!

--  
David.

On Mon, Jun 27, 2011 at 6:01 PM, Nanami 13
deconstructed.morn...@gmail.com wrote:

Hi everyone,

I am trying to find a way to filter a table; If I am given for  
example the

following table:

head(intra)
  chr miRNA   start end strand  ACC  
hsa_ID

region region_start region_end   gene_id transcrip_id
1 chr1 miRNA 1102484 1102578  + ACC=MI342; ID=hsa- 
mir-200b;

exon  11024841102578 NR_029639NR_029639
2 chr1 miRNA 1103243 1103332  + ACC=MI737; ID=hsa- 
mir-200a;

exon  11032431103332 NR_029834NR_029834
3 chr1 miRNA 1104385 1104467  + ACC=MI0001641;  ID=hsa- 
mir-429;

exon  11043851104467 NR_029957NR_029957
4 chr1 miRNA 3044539 3044599  + ACC=MI0015861; ID=hsa- 
mir-4251;

exon  30445393044599 NR_036215NR_036215
5 chr1 miRNA 3477260 3477354  - ACC=MI0003556; ID=hsa- 
mir-551a;

exon  34772603477354 NR_030277NR_030277
6 chr1 miRNA 6489894 6489956  - ACC=MI0015864; ID=hsa- 
mir-4252;

exon  64898946489956 NR_036218NR_036218

I would only like to keep in the table the rows that have intra 
$start !=

intra$region_start and intra$end != intra$region_end.
I've tried using this but I get the following error:



intra- intra[(intra$start != intra$region_start )(intra$end !=

intra$region_end)]

head(intra)

data frame with 0 columns and 6 rows

Thank you,

best,
Nanami

   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.





--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] create a new data frame after comparing two columns of the previous data frame

2011-06-27 Thread Nanami
it's a table; I read it from a file; I've tried to make it look prettier:

 head(intra)
 chr   miRNA   start end   strand  ACC
hsa_ID   region region_start region_end  
 chr1 miRNA 1102484 1102578  +   ACC=MI342; ID=hsa-mir-200b;  
exon  11024841102578 
 chr1 miRNA 1103243 1103332  +   ACC=MI737; ID=hsa-mir-200a;  
exon  11032431103332 
 chr1 miRNA 1104385 1104467  +   ACC=MI0001641;  ID=hsa-mir-429;  
exon  11043851104467 
 chr1 miRNA 3044539 3044599  +   ACC=MI0015861; ID=hsa-mir-4251;  
exon  30445393044599 
 chr1 miRNA 3477260 3477354  -   ACC=MI0003556; ID=hsa-mir-551a;  
exon  34772603477354 
 chr1 miRNA 6489894 6489956  -   ACC=MI0015864; ID=hsa-mir-4252;  
exon  64898946489956 


When I changed  with   I got this error:

 new - intra[(intra$start != intra$region_start )(intra$end !=
 intra$region_end)]
Error in `[.data.frame`(intra, (intra$start != intra$region_start) 
(intra$end !=  : 
  undefined columns selected

What I would like to do is to create a new table that only contains the rows
for which column start and region_start are not the same.



--
View this message in context: 
http://r.789695.n4.nabble.com/create-a-new-data-frame-after-comparing-two-columns-of-the-previous-data-frame-tp3628981p3629092.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] create a new data frame after comparing two columns of the previous data frame

2011-06-27 Thread David Winsemius

Right. You forgot the comma!

--  
David.


On Jun 27, 2011, at 7:10 PM, Nanami wrote:

it's a table; I read it from a file; I've tried to make it look  
prettier:



head(intra)

chr   miRNA   start end   strand  ACC
hsa_ID   region region_start region_end
chr1 miRNA 1102484 1102578  +   ACC=MI342; ID=hsa- 
mir-200b;

exon  11024841102578
chr1 miRNA 1103243 1103332  +   ACC=MI737; ID=hsa- 
mir-200a;

exon  11032431103332
chr1 miRNA 1104385 1104467  +   ACC=MI0001641;  ID=hsa- 
mir-429;

exon  11043851104467
chr1 miRNA 3044539 3044599  +   ACC=MI0015861; ID=hsa- 
mir-4251;

exon  30445393044599
chr1 miRNA 3477260 3477354  -   ACC=MI0003556; ID=hsa- 
mir-551a;

exon  34772603477354
chr1 miRNA 6489894 6489956  -   ACC=MI0015864; ID=hsa- 
mir-4252;

exon  64898946489956


When I changed  with   I got this error:


new - intra[(intra$start != intra$region_start )(intra$end !=
intra$region_end)]

Error in `[.data.frame`(intra, (intra$start != intra$region_start) 
(intra$end !=  :
 undefined columns selected

What I would like to do is to create a new table that only contains  
the rows

for which column start and region_start are not the same.



--
View this message in context: 
http://r.789695.n4.nabble.com/create-a-new-data-frame-after-comparing-two-columns-of-the-previous-data-frame-tp3628981p3629092.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.