Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible error in transform.Rmd / tbl_dfs now do partial matching? #89

Closed
khumph opened this issue Apr 5, 2016 · 1 comment
Closed

Comments

@khumph
Copy link

khumph commented Apr 5, 2016

In the Data Transformation chapter, the following is written:

  • When you extract a variable with $, tbl_dfs never do partial
    matching. They'll throw an error if the column doesn't exist:
df <- data.frame(abc = 1)
df$a

df2 <- data_frame(abc = 1)
df2$a

However the live version of the r4ds website (immediately above http://r4ds.had.co.nz/transform.html#dplyr-verbs) implies that partial matching does work. At any rate, it doesn't throw an error, as was meant to be illustrated.

I get the same in my R console:

df <- data.frame(abc = 1)
df$a
#> [1] 1

df2 <- data_frame(abc = 1)
df2$a
#> [1] 1

Do tbl_dfs now do partial matching with $?

FYI:

sessionInfo()
#> R version 3.2.4 (2016-03-10)
#> Platform: x86_64-apple-darwin13.4.0 (64-bit)
#> Running under: OS X 10.11.4 (El Capitan)
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] reprex_0.0.0.9001 dplyr_0.4.3      
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_0.12.4     knitr_1.12.3    magrittr_1.5    splines_3.2.4  
#>  [5] MASS_7.3-45     lattice_0.20-33 R6_2.1.2        minqa_1.2.4    
#>  [9] stringr_1.0.0   tools_3.2.4     parallel_3.2.4  grid_3.2.4     
#> [13] nlme_3.1-125    DBI_0.3.1       clipr_0.2.0     htmltools_0.3.5
#> [17] lme4_1.1-11     lazyeval_0.1.10 assertthat_0.1  digest_0.6.9   
#> [21] Matrix_1.2-4    nloptr_1.0.4    formatR_1.3     evaluate_0.8.3 
#> [25] rmarkdown_0.9.5 stringi_1.0-1
@hadley
Copy link
Owner

hadley commented Apr 5, 2016

It's fixed in the dev version of dplyr.

@hadley hadley closed this as completed Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants