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 6713391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:22:31+00:00 2026-05-26T08:22:31+00:00

I have the following matrix (actually a data frame) in R: > str(x2) ‘data.frame’:

  • 0

I have the following matrix (actually a data frame) in R:

> str(x2)
'data.frame':   274569 obs. of  15 variables:
 $ ykod : int  99 99 99 99 99 99 99 99 99 99 ...
 $ yad  : Factor w/ 43 levels "BAKUGAN","BARBIE",..: 2 2 2 2 2 2 2 2 2 2 ...
 $ per  : Factor w/ 3 levels "2 AYLIK","3 AYLIK",..: 3 3 3 3 3 3 3 3 3 3 ...
 $ donem: int  201106 201106 201106 201106 201106 201106 201106 201106 201106 201106 ...
 $ sayi : int  201106 201106 201106 201106 201106 201106 201106 201106 201106 201106 ...
 $ mkod : int  359 361 362 363 366 847 849 850 1505 1506 ...
 $ mad  : Factor w/ 11045 levels "    Hilal Gida           ",..: 5163 3833 10840 8284 10839 2633 10758 10293 6986 6984 ...
 $ mtip : Factor w/ 30 levels "Abone Bürosu                                      ",..: 20 20 20 20 20 2 2 2 11 11 ...
 $ kanal: Factor w/ 2 levels "OB","SS": 2 2 2 2 2 2 2 2 1 1 ...
 $ bkod : int  110006 110006 110006 110006 110006 110006 110006 110006 110006 110006 ...
 $ bad  : Factor w/ 213 levels "4. Levent","500 Evler",..: 25 25 25 25 25 25 25 25 25 25 ...
 $ bolge: Factor w/ 12 levels "Adana Şehiriçi",..: 7 7 7 7 7 7 7 7 7 7 ...
 $ sevk : int  5 2 2 2 10 0 4 3 13 32 ...
 $ iade : int  0 2 1 2 4 0 3 2 0 8 ...
 $ satis: int  5 0 1 0 6 0 1 1 13 24 ...

I’d like to create subsets from this main data frame. For example, I need a sub-matrix having multiple conditions fulfilled, such as
ykod = 123 and donem = 201109 and sevk > 20 and satis > 10.

How can I achieve that?

  • 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-26T08:22:31+00:00Added an answer on May 26, 2026 at 8:22 am
    x2[x2$ykod == 123 & x2$donem == 201109 & x2$sevk > 20 & x2$satis > 10,]
    

    or, to make it shorter:

    with(x2, x2[ykod == 123 & donem == 201109 & sevk > 20 & satis > 10,])
    

    or, if the columns are attached to global variables (with attach(x2)), you can
    just write

    x2[ykod == 123 & donem == 201109 & sevk > 20 & satis > 10,]
    

    if you want just columns ykod and yad:

    x2[x2$ykod == 123 & x2$donem == 201109 & x2$sevk > 20 & x2$satis > 10, c('ykod', 'yad')]
    

    if you want only first 4 columns (I shortened the condition here):

    x2[x2$ykod == 123, 1:4]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following sparse matrix that contains O(N) elements boost::numeric::ublas::compressed_matrix<int> adjacency (N, N);
If I have the following matrix: import numpy ar = numpy.array((('0','1','2','3'), ('1','a','b','b'), ('2','b','c','d')), str)
I have the following code in the caller function int matrix[3][3] = {{1, 2,
Say I have the following matrix: A = randi(10, [6 3]) 7 10 3
I have several blocks of the following code that each use there own matrix.
I have following string String str = replace :) :) with some other string;
Assume we have the following data: H_T = [36 66 21 65 52 67
Suppose I have the following matrix: 01 02 03 06 03 05 07 02
I have the following problem Assume that we have a 9*8 matrix A matrix
In MonoDevelop I have the following code which compiles: int[] row = new int[indices.Count]{};

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.