select not working?

3,313 views
Skip to first unread message

Imanuel Costigan

unread,
Jun 16, 2015, 6:43:36 AM6/16/15
to manip...@googlegroups.com
I run the following

> library("dplyr")
> iris <- tbl_df(iris)
> iris %>% select(Sepal.Length)



I get

Error in select(., Sepal.Length) : unused argument (Sepal.Length)



Is this a change in dplyr behaviour? This seems inconsistent with my experience so far.


> session_info()
Session info -----------------------------------------------------------------------------------
 setting  value                      
 version  R version
3.2.0 (2015-04-16)
 system   x86_64
, mingw32            
 ui      
RStudio (0.99.442)          
 language
(EN)                        
 collate  
English_Australia.1252      
 tz      
Australia/Sydney            


Packages ---------------------------------------------------------------------------------------
 
package    * version date       source        
 assertthat  
0.1     2013-12-06 CRAN (R 3.2.0)
 curl        
0.8     2015-06-06 CRAN (R 3.2.0)
 DBI        
* 0.3.1   2014-09-24 CRAN (R 3.2.0)
 devtools  
* 1.8.0   2015-05-09 CRAN (R 3.2.0)
 digest      
0.6.8   2014-12-31 CRAN (R 3.2.0)
 dplyr      
* 0.4.2   2015-06-16 CRAN (R 3.2.0)
 git2r        
0.10.1  2015-05-07 CRAN (R 3.2.0)
 lazyeval    
0.1.10  2015-01-02 CRAN (R 3.2.0)
 lubridate  
* 1.3.3   2013-12-31 CRAN (R 3.2.0)
 magrittr    
1.5     2014-11-22 CRAN (R 3.2.0)
 MASS      
* 7.3-40  2015-03-21 CRAN (R 3.2.0)
 memoise      
0.2.1   2014-04-22 CRAN (R 3.2.0)
 plyr        
1.8.3   2015-06-12 CRAN (R 3.2.0)
 R6          
2.0.1   2014-10-29 CRAN (R 3.2.0)
 
Rcpp         0.11.6  2015-05-01 CRAN (R 3.2.0)
 readr      
* 0.1.1   2015-05-29 CRAN (R 3.2.0)
 readxl    
* 0.1.0   2015-04-14 CRAN (R 3.2.0)
 reshape2    
1.4.1   2014-12-06 CRAN (R 3.2.0)
 rversions    
1.0.1   2015-06-06 CRAN (R 3.2.0)
 stringi      
0.4-1   2014-12-14 CRAN (R 3.2.0)
 stringr    
* 1.0.0   2015-04-30 CRAN (R 3.2.0)
 tidyr      
* 0.2.0   2014-12-05 CRAN (R 3.2.0)
 xml2        
0.1.1   2015-06-02 CRAN (R 3.2.0)



Imanuel Costigan

unread,
Jun 16, 2015, 6:45:37 AM6/16/15
to manip...@googlegroups.com
Also:

> iris %>% select_("Sepal.Length")
Source: local data frame [150 x 1]


   
Sepal.Length
1           5.1
2           4.9
3           4.7
4           4.6
5           5.0
6           5.4
7           4.6
8           5.0
9           4.4
10          4.9
..          ...

Hadley Wickham

unread,
Jun 16, 2015, 8:05:14 AM6/16/15
to Imanuel Costigan, manipulatr
Works for me. Are you sure you haven't accidentally overridden select?
Hadley
> --
> You received this message because you are subscribed to the Google Groups
> "manipulatr" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to manipulatr+...@googlegroups.com.
> To post to this group, send email to manip...@googlegroups.com.
> Visit this group at http://groups.google.com/group/manipulatr.
> For more options, visit https://groups.google.com/d/optout.



--
http://had.co.nz/

Imanuel Costigan

unread,
Jun 16, 2015, 6:39:02 PM6/16/15
to manip...@googlegroups.com, i.cos...@me.com
Must have been corrupted library. Deleted everything and started again and now it works. Hurray!

Imanuel Costigan

unread,
Jun 16, 2015, 6:46:44 PM6/16/15
to manip...@googlegroups.com
Nope wasn't that. I was loading MASS after dplyr. That meant dplyr's select was being masked. Lesson: almost always load dplyr last.

mkrasmus

unread,
Jul 10, 2017, 11:47:58 PM7/10/17
to manipulatr
Removing MASS after loading dplyr also causes the same problem. Yes sirree.

David Winsemius

unread,
Jul 11, 2017, 2:26:12 AM7/11/17
to mkrasmus, manipulatr

> On Jul 10, 2017, at 8:47 PM, mkrasmus <mkra...@gmail.com> wrote:
>
> Removing MASS after loading dplyr also causes the same problem. Yes sirree.
>
> On Wednesday, 17 June 2015 08:46:44 UTC+10, Imanuel Costigan wrote:
> Nope wasn't that. I was loading MASS after dplyr. That meant dplyr's select was being masked. Lesson: almost always load dplyr last.

I suppose that's one possible moral. The other moral might be: Read the package messages:

> library(dplyr)
> library(MASS)

Attaching package: ‘MASS’

The following object is masked from ‘package:dplyr’:

select


>

--
David.
> Visit this group at https://groups.google.com/group/manipulatr.
> For more options, visit https://groups.google.com/d/optout.

David Winsemius
Alameda, CA, USA

Reply all
Reply to author
Forward
0 new messages