title: Selecting a subset of data in dplyr with 2 select verbs
body: <p>I currently have this dplyr script to select certain data points. In the first select statement I am collecting all my needed columns. In the summarise statement I am creating some needed manipulations (basically concatenations). In my final select verb I am looking to select <strong>ONLY</strong> what is in my final select statement. However, when I view my data frame it still contains columns that were used in the summarise verb despite them not being selected in the final select ver. I would like to drop those columns. Below is a screenshot of the columns that are remaining but would like to exclude (in red)</p>
  <pre><code>data &lt;-  qc_sales %&gt;%
    mutate(Call_For_Price = ifelse(CFP_FLG == 1, &quot;TRUE&quot;, &quot;FALSE&quot;)) %&gt;% 
   filter(    STR_NBR != '8119'
            , Opened_Quote_Flag == 1
            , LWK_TY_LY_FLG == 'TY'
            , MVNDR_NBR %in% c('60031167', '60688509', '60074051', '60148060', '60086898', '60080204')
            , !SUB_DEPT_NBR %in% c('0025','0028')) %&gt;% 
     select(  QUOTE_DT
            , COM_ORDER_NBR  
            , STR_NBR
            , ST_CD
            , BRANCH_NM
            , MKT_NBR
            , MKT_NM
            , ASSC_FRST_NM
            , ASSC_LAST_NM
            , MAIN_STR_PHN_NBR
            , MVNDR_NBR
            , MVNDR_NM
            , SUB_DEPT_NBR
            , SUB_DEPT_DESC
            , PROD_DESC
            , ADD_PROD_DESC
            , Manufacturer_Model_NBR
            , Call_For_Price
            , QUOTE_DLRS) %&gt;% 
    group_by(QUOTE_DT
            , COM_ORDER_NBR  
            , STR_NBR
            , ST_CD
            , BRANCH_NM
            , MKT_NBR
            , MKT_NM
            , ASSC_FRST_NM
            , ASSC_LAST_NM
            , MAIN_STR_PHN_NBR
            , MVNDR_NBR
            , MVNDR_NM
            , SUB_DEPT_NBR
            , SUB_DEPT_DESC
            , PROD_DESC
            , ADD_PROD_DESC
            , Manufacturer_Model_NBR
            , Call_For_Price
              ) %&gt;% 
    summarise(Quote_Dollars =sum(QUOTE_DLRS)
            , Sub_Dept = MAX(CONCAT(SUB_DEPT_NBR,'-', SUB_DEPT_DESC))
            , Market_Nbr_Nm = MAX(CONCAT(MKT_NBR,'-', MKT_NM))
            , Associate_Name = MAX(CONCAT(ASSC_FRST_NM,'-', ASSC_LAST_NM))
            , MVNDR = MAX(CONCAT(MVNDR_NBR,'-', MVNDR_NM))) %&gt;% 
    select(  QUOTE_DT
           , COM_ORDER_NBR
           , STR_NBR
           , ST_CD
           , BRANCH_NM
           , MAIN_STR_PHN_NBR
           , Market_Nbr_Nm
           , Associate_Name
           , MAIN_STR_PHN_NBR
           , Sub_Dept
           , MVNDR
           , PROD_DESC
           , ADD_PROD_DESC
           , Manufacturer_Model_NBR
           , Call_For_Price
           , Quote_Dollars) %&gt;% 
    arrange(desc(Quote_Dollars)) %&gt;%  
    collect()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/hq6Iw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hq6Iw.png" alt="enter image description here" /></a></p>
  <p>In other words, I am not understanding why the highlighted columns are included in my data frame if they are not selected in the second select verb. I thought the order of operations in dplyr is basically descending</p>