Variable with two attributes from different data frames need to be plotted in R





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have 2 data frames D1 and D2,



D1 looks like this:



  A  B  C  D  E 

1 NA x x x x
2 x NA x NA x
3 NA NA NA x NA
4 x x NA x NA
.
.
100 x x NA x x


D2 looks like this:



  a  b  c  d  e 

1 NA x x x NA
2 x x x NA x
3 NA NA x x NA
4 x x NA x x
.
.
100 x x NA x x


The 1 2 3 represent names, and the ABC represent 'significance' and abc represent 'membership'.



( I already did this step) I need to first filter out the NA's from a particular significance column say B, so I get:



     B
1 x
4 x
.
.
1000 x


So I saved that as a data frame.
Now, I need get the values from columns a b c d... for the numbers that were x in B (so 1,4...1000 in this case).



So finally I need something that looks like this:



     a  b  c  d  e 

1 NA x x x NA
4 x x NA x x
.
.
1000 x x NA x x


And if I needed to, from this final form, how would I remove all the rows that contain an na in it? In this case we would lose 1,4 and 1000 but say (4,c) was not NA, how would I only keep that?



Thank you










share|improve this question





























    0















    I have 2 data frames D1 and D2,



    D1 looks like this:



      A  B  C  D  E 

    1 NA x x x x
    2 x NA x NA x
    3 NA NA NA x NA
    4 x x NA x NA
    .
    .
    100 x x NA x x


    D2 looks like this:



      a  b  c  d  e 

    1 NA x x x NA
    2 x x x NA x
    3 NA NA x x NA
    4 x x NA x x
    .
    .
    100 x x NA x x


    The 1 2 3 represent names, and the ABC represent 'significance' and abc represent 'membership'.



    ( I already did this step) I need to first filter out the NA's from a particular significance column say B, so I get:



         B
    1 x
    4 x
    .
    .
    1000 x


    So I saved that as a data frame.
    Now, I need get the values from columns a b c d... for the numbers that were x in B (so 1,4...1000 in this case).



    So finally I need something that looks like this:



         a  b  c  d  e 

    1 NA x x x NA
    4 x x NA x x
    .
    .
    1000 x x NA x x


    And if I needed to, from this final form, how would I remove all the rows that contain an na in it? In this case we would lose 1,4 and 1000 but say (4,c) was not NA, how would I only keep that?



    Thank you










    share|improve this question

























      0












      0








      0








      I have 2 data frames D1 and D2,



      D1 looks like this:



        A  B  C  D  E 

      1 NA x x x x
      2 x NA x NA x
      3 NA NA NA x NA
      4 x x NA x NA
      .
      .
      100 x x NA x x


      D2 looks like this:



        a  b  c  d  e 

      1 NA x x x NA
      2 x x x NA x
      3 NA NA x x NA
      4 x x NA x x
      .
      .
      100 x x NA x x


      The 1 2 3 represent names, and the ABC represent 'significance' and abc represent 'membership'.



      ( I already did this step) I need to first filter out the NA's from a particular significance column say B, so I get:



           B
      1 x
      4 x
      .
      .
      1000 x


      So I saved that as a data frame.
      Now, I need get the values from columns a b c d... for the numbers that were x in B (so 1,4...1000 in this case).



      So finally I need something that looks like this:



           a  b  c  d  e 

      1 NA x x x NA
      4 x x NA x x
      .
      .
      1000 x x NA x x


      And if I needed to, from this final form, how would I remove all the rows that contain an na in it? In this case we would lose 1,4 and 1000 but say (4,c) was not NA, how would I only keep that?



      Thank you










      share|improve this question














      I have 2 data frames D1 and D2,



      D1 looks like this:



        A  B  C  D  E 

      1 NA x x x x
      2 x NA x NA x
      3 NA NA NA x NA
      4 x x NA x NA
      .
      .
      100 x x NA x x


      D2 looks like this:



        a  b  c  d  e 

      1 NA x x x NA
      2 x x x NA x
      3 NA NA x x NA
      4 x x NA x x
      .
      .
      100 x x NA x x


      The 1 2 3 represent names, and the ABC represent 'significance' and abc represent 'membership'.



      ( I already did this step) I need to first filter out the NA's from a particular significance column say B, so I get:



           B
      1 x
      4 x
      .
      .
      1000 x


      So I saved that as a data frame.
      Now, I need get the values from columns a b c d... for the numbers that were x in B (so 1,4...1000 in this case).



      So finally I need something that looks like this:



           a  b  c  d  e 

      1 NA x x x NA
      4 x x NA x x
      .
      .
      1000 x x NA x x


      And if I needed to, from this final form, how would I remove all the rows that contain an na in it? In this case we would lose 1,4 and 1000 but say (4,c) was not NA, how would I only keep that?



      Thank you







      r






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 0:00









      Kushal MohnotKushal Mohnot

      12




      12
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454050%2fvariable-with-two-attributes-from-different-data-frames-need-to-be-plotted-in-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454050%2fvariable-with-two-attributes-from-different-data-frames-need-to-be-plotted-in-r%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()