shawin
2015-Sep-03 06:58 UTC
[R] Extracting column value from csv file according to if else and & operator
I should extract the value according to the condition above On Thu, Sep 3, 2015 at 7:57 AM, Navien [via R] < ml-node+s789695n4711782h41 at n4.nabble.com> wrote:> Hi all > I have a csv file and i would like to extract the value of it with > specific range fof the last column for example; F>2 & F<2 & P=1, and then > write the result to csv file. > > the data is : > > x1 x2 x3 x4 x5 x6 > 9.488404 9.470895 9.282434 9.366707 9.955383 9.640816 > 8.63063 8.558311 8.788391 8.576231 8.671588 8.84298 > 9.354749 9.367669 9.259953 9.421538 9.554635 9.603745 > 9.944864 9.950428 10.19102 10.07351 10.0327 10.13079 > Fc p > 1.037883 0.320095 > 1.057708 0.060132 > 1.065191 0.111192 > > > > I tried the code bellow but , it does not work? > > FCPval <- > read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/FCPval.csv") > > c=as.data.frame(FCPval) > > for (i in 1:rowN){if (C$F[i] >= 2 && C$F[i]<=-2&& C$p[i]<=3){ > > dfrmPFC=data.frame(Fc=FC,p=p)} > } > > the error is : > > Error in C$FC : object of type 'closure' is not subsettable. > > can i extract the value according to the condition > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/Extracting-column-value-from-csv-file-according-to-if-else-and-operator-tp4711782.html > To start a new topic under R help, email > ml-node+s789695n789696h75 at n4.nabble.com > To unsubscribe from R, click here > <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=789695&code=c2hhd2lua2FyaW1AZ21haWwuY29tfDc4OTY5NXwtMjQ0MzkwMjQ1> > . > NAML > <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >-- View this message in context: http://r.789695.n4.nabble.com/Extracting-column-value-from-csv-file-according-to-if-else-and-operator-tp4711782p4711783.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]