Keep rows with columns having values between -1 and 1 from a dataframe in R

Keep rows with columns having values between -1 and 1 from a dataframe in R

1

I have a dataframe in R that looks like this:

   V1         T1         T2         T3         T4        T5
  CXCL6  0.8536601  1.0903336  3.7633042  5.5800459 5.8477150
  PPBP  0.7739450  0.3587961  0.5073359  0.2743522 0.6221722
  CXCL10  0.1258370 -0.3535165 -0.7460387  3.5604672 0.1971432
  CXCL11 -0.2563139  0.7117200  0.0000000 -0.2288303 0.9955557
  CXCL12  0.6181279  1.7529310  1.7637760  1.2752787 1.2284810

I want to keep the rows that have values only between -1 and 1.

I have tried this command but unfortunately it does not work.

condition1 <- Genes[,c(2:6)] <=-1 & Genes[,c(2:6)] >=1
Genes <- Genes[condition1,]

Can someone tell me where I am wrong so that I can successfully filter my dataframe.


R

• 43 views

Read more here: Source link

Tagged