Question: (Closed) Extracting column value from csv file according to if else and & operator
0
gravatar for shawin
4.0 years ago by
shawin10
United Kingdom
shawin10 wrote:

 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 

R • 1.7k views
ADD COMMENTlink modified 4.0 years ago • written 4.0 years ago by shawin10

Failing to see why this is a bionformatics question...

ADD REPLYlink written 4.0 years ago by Michael Dondrup46k

It also is a duplicate question, see post; 156628 (Extracting value from csv file with condition using if else and & operator)

ADD REPLYlink modified 4.0 years ago • written 4.0 years ago by Lesley Sitter460

Hello shawinkarim!

We believe that this post does not fit the main topic of this site.

This is a beginner's pure R question. You need to take a course in R or read the manual on R datastructures.

Some mistakes:

  • R variable names are case sensitive
  • Don't name your variables like existing functions (both c,C are functions defined already)
  • Don't use for loops for indexing something

 

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink modified 4.0 years ago • written 4.0 years ago by Michael Dondrup46k
0
gravatar for Jean-Karim Heriche
4.0 years ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche20k wrote:

This error message usually means you're trying to use an index on a function. Anyway, this is a programming question not a bioinformatics one. Try Stack Overflow for this sort of things.

ADD COMMENTlink written 4.0 years ago by Jean-Karim Heriche20k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2003 users visited in the last hour