[R] How to extract or sort values from one column

K. Elo m@||||@t@ @end|ng |rom pp@|net@||
Fri Jan 31 17:31:02 CET 2020


Hi!

To extract full rows, use:

df[ ( (df$Value>=0.2 & df$Value<=0.4) | df$Value>=0.7 ), ]


But it is also a good idea to start reading some introductory
tutorials. These are basic things you can find in all tutorials :-)

Best,
Kimmo

pe, 2020-01-31 kello 10:50 -0500, pooja sinha kirjoitti:
> Thanks for providing the code but I also needed the output sheet in
> .csv format with all the four columns corresponding to the value
> (Chrom,
> Start_pos, End_pos & Value ranging from what I specified earlier).
> 
> Puja
> 
> On Fri, Jan 31, 2020 at 10:23 AM K. Elo <maillists using pp.inet.fi> wrote:
> 
> > Hi!
> > 
> > Oh, sorry, one "s" too much in my code. Here the correct one:
> > 
> > df$Value[ (df$Value>=0.2 & df$Value<=0.4) | df$Value>=0.7 ]
> > 
> > Best,
> > Kimmo
> > 
> > pe, 2020-01-31 kello 17:12 +0200, K. Elo kirjoitti:
> > > Hi!
> > > 
> > > Let's assume your data is stored in a data frame called 'df'. So
> > > this
> > > code should do the job:
> > > 
> > > df$Value[ (df$Value>=0.2 & df$Values<=0.4) | df$Value>=0.7 ]
> > > 
> > > Best,
> > > Kimmo
> > > 
> > > 
> > > 
> > > pe, 2020-01-31 kello 09:21 -0500, pooja sinha kirjoitti:
> > > > Hi All,
> > > > 
> > > > I have a .csv file with four columns (Chrom, Start_pos, End_pos
> > > > &
> > > > Value).
> > > > The value column range from 0 to 1.0 having more than 2.8
> > > > million
> > > > rows. I
> > > > need to write a code from which I can extract the values from
> > > > 0.2-
> > > > 0.4
> > > > &
> > > > 0.7-1.0. Could anyone help me in writing the code because I am
> > > > new
> > > > to
> > > > R and
> > > > it takes lot of time manually to sort based on values.
> > > > 
> > > > The only part I know is I can read the .csv file and after that
> > > > I
> > > > don’t
> > > > know how to proceed further.
> > > > 
> > > > 
> > > > Thanks,
> > > > 
> > > > Puja
> > > > 
> > > >     [[alternative HTML version deleted]]
> > > > 
> > > > ______________________________________________
> > > > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more,
> > > > see
> > > > 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 using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > 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 using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
> >



More information about the R-help mailing list