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

  • Home
  • SEARCH
  • 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 6603783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:03:41+00:00 2026-05-25T19:03:41+00:00

I have read in a csv file in matrix form (having m rows and

  • 0

I have read in a csv file in matrix form (having m rows and n columns). I want to filter the matrix by conducting a filter in verbal form:

Select all values from column x where the values of an another column in this row is equal to “blabla”.

It is like a select statement in database where I say I am interested in a subset of the matrix where these constraints need to be satisfied.

How can I do it in r? I have the data as dataframe and can access it by the headers. data["column_values" = "15"] does not give me back the rows where the column named column_values have values 15 only.

Thanks

  • 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-05-25T19:03:42+00:00Added an answer on May 25, 2026 at 7:03 pm

    You said you just wanted the column x values where column_values was 15, right?

    subset(dat, column_values==15, select=x)
    

    I think this may come as a dataframe so it’s possble you may need to unlist() it and maybe even “unfactor” it.

    > dat
      Subject Product
    1       1   ProdA
    2       1   ProdB
    3       1   ProdC
    4       2   ProdB
    5       2   ProdC
    6       2   ProdD
    7       3   ProdA
    8       3   ProdB
    > subset(dat, Subject==2, Product)
      Product
    4   ProdB
    5   ProdC
    6   ProdD
    > unlist( subset(dat, Subject==2, Product) )
    Product1 Product2 Product3 
       ProdB    ProdC    ProdD 
    Levels: ProdA ProdB ProdC ProdD
    > as.character( unlist( subset(dat, Subject==2, Product) ) )
    [1] "ProdB" "ProdC" "ProdD"
    

    If you want all of the columns you can drop the third argument (the select= argument):

    subset(dat, Subject==2 )
    
      Subject Product
    4       2   ProdB
    5       2   ProdC
    6       2   ProdD
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read a CSV file's columns directly into variables. The result should
I have following sample CSV file rc,u,s,ui,gh m,1,8,0,12 n,3,0,0,7 d,1,1,8,0 I want to read
How to read and import .csv file in groovy on grails. I have .csv
I have a problem to write and read properly a CSV file composed of
I have my CSV file imported as such: records = FasterCSV.read(path, :headers => true,
I have a csv file that I am trying to read in R, for
I have a small script we're using to read in a CSV file containing
i have to read CSV file in java, I googled it but i got
I have a need to read a CSV file, and the only language I
I have a 10GB CSV file which is essentially a huge square matrix. I

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.