Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:11:01+00:00 2026-06-15T14:11:01+00:00

Possible Duplicate: R: subset() logical-and operator for combining conditions should be & not &&

  • 0

Possible Duplicate:
R: subset() logical-and operator for combining conditions should be & not &&

I have a simple question, but I don’t know how to solve this…
I want to select all rows where value_1 > 0 and value_2 > 0.
Now I have this code:

dataOnBoth<-data[data$value_1 > 0,][data$value_2 > 0,]

When I head this data, ordering on log2_fold_change, I have This output:

gene_id        sample_1 sample_2 status   value_1 value_2 log2_fold_change
86  uc001aen.1       q1       q2 NOTEST 0.0619347       0    -1.79769e+308
150 uc001ahx.1       q1       q2 NOTEST 0.0432199       0    -1.79769e+308
186 uc001ajk.1       q1       q2 NOTEST 0.0854541       0    -1.79769e+308
251 uc001amf.1       q1       q2 NOTEST 0.0636211       0    -1.79769e+308
358 uc001are.3       q1       q2 NOTEST 0.3642040       0    -1.79769e+308
394 uc001ass.1       q1       q2 NOTEST 0.0196794       0    -1.79769e+308
        test_stat   p_value q_value significant
86  -1.79769e+308 0.4767020       1          no
150 -1.79769e+308 0.3960920       1          no
186 -1.79769e+308 0.0631033       1          no
251 -1.79769e+308 0.4428030       1          no
358 -1.79769e+308 0.1083640       1          no
394 -1.79769e+308 0.1489190       1          no

So R didn’t test the second condition…
When using the & to test both conditions, I receive 0 rows:

dataOnBoth<-data[data$value_1 > 0 && data$value_2 > 0,]

How do I select all rows where value_1 > 0 and value_2 > 0?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:11:02+00:00Added an answer on June 15, 2026 at 2:11 pm

    You need to use a single ‘&’:

    dataOnBoth = data[data$value_1 > 0 & data$value_2 > 0,]
    

    See this question for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web
Possible Duplicate: Check whether an array is a subset of another I have array
Possible Duplicate: “C subset of C++” -> Where not ? examples ? I'm aware
Possible Duplicate: Algorithm: Extract subset based on property sum in the simple case we
Possible Duplicate: “C subset of C++” -> Where not ? examples? I am aware
Possible Duplicate: Extracting dollar amounts from existing sql data? I have a column in
Possible Duplicate: First split then join a subset of a string I'm trying to
Possible Duplicate: dropping factor levels in a subsetted data frame in R I have
Possible Duplicate: What Web Application Framework for Delphi is recommended? We have a Delphi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.