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

dataset conflicts between packages are not resolved with conflicts #54

Closed
njtierney opened this issue Sep 1, 2020 · 0 comments
Closed
Labels
feature a feature request or enhancement

Comments

@njtierney
Copy link

# remotes::install_github("njtierney/brolgar")
library(brolgar) 

heights
#> # A tsibble: 1,490 x 4 [!]
#> # Key:       country [144]
#>    country     continent  year height_cm
#>    <chr>       <chr>     <dbl>     <dbl>
#>  1 Afghanistan Asia       1870      168.
#>  2 Afghanistan Asia       1880      166.
#>  3 Afghanistan Asia       1930      167.
#>  4 Afghanistan Asia       1990      167.
#>  5 Afghanistan Asia       2000      161.
#>  6 Albania     Europe     1880      170.
#>  7 Albania     Europe     1890      170.
#>  8 Albania     Europe     1900      169.
#>  9 Albania     Europe     2000      168.
#> 10 Algeria     Africa     1910      169.
#> # … with 1,480 more rows

library(modelr)
#> 
#> Attaching package: 'modelr'
#> The following object is masked from 'package:brolgar':
#> 
#>     heights

heights
#> # A tibble: 7,006 x 8
#>    income height weight   age marital  sex    education  afqt
#>     <int>  <dbl>  <int> <int> <fct>    <fct>      <int> <dbl>
#>  1  19000     60    155    53 married  female        13  6.84
#>  2  35000     70    156    51 married  female        10 49.4 
#>  3 105000     65    195    52 married  male          16 99.4 
#>  4  40000     63    197    54 married  female        14 44.0 
#>  5  75000     66    190    49 married  male          14 59.7 
#>  6 102000     68    200    49 divorced female        18 98.8 
#>  7      0     74    225    48 married  male          16 82.3 
#>  8  70000     64    160    54 divorced female        12 50.3 
#>  9  60000     69    162    55 divorced male          12 89.7 
#> 10 150000     69    194    54 divorced male          13 96.0 
#> # … with 6,996 more rows

# there are two datasets with the same name!

# conflicted to help?
library(conflicted)
conflict_prefer("heights", "brolgar")
#> [conflicted] Will prefer brolgar::heights over any other package

# not quite
heights_fit <- lm(height_cm ~ year, heights)
#> Error in eval(predvars, data, env): object 'height_cm' not found

# this works though
heights_fit_b <- lm(height_cm ~ year, brolgar::heights)

Created on 2020-09-01 by the reprex package (v0.3.0)

I was imagining that conflicted would help with resolving datasets, so was hoping that

conflict_prefer("heights", "brolgar")

Would mean that the brolgar::heights would be preferred over modelr::heights.

@hadley hadley added the feature a feature request or enhancement label Nov 25, 2021
@hadley hadley closed this as completed in 9c42e52 Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants