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

add names method for bcdc_promise #278

Merged
merged 17 commits into from
Sep 8, 2021
Merged

add names method for bcdc_promise #278

merged 17 commits into from
Sep 8, 2021

Conversation

boshek
Copy link
Collaborator

@boshek boshek commented Aug 13, 2021

Add names method to extract column names easily.

@ateucher if you think this is a good idea, I'll add some tests.

@boshek boshek requested a review from ateucher August 13, 2021 17:17
@boshek boshek marked this pull request as draft August 13, 2021 20:22
@boshek
Copy link
Collaborator Author

boshek commented Aug 13, 2021

Actually this isn't as simple as I thought. Out of the box, the method doesn't respect previous select steps:

R> library(bcdata)
R> bcdc_query_geodata('2af1388e-d5f7-46dc-a6e2-f85415ddbd1c') %>% 
   names()
 [1] "id"                       "LINEAR_FEATURE_ID"        "WATERSHED_GROUP_ID"       "EDGE_TYPE"               
 [5] "WATERBODY_KEY"            "BLUE_LINE_KEY"            "WATERSHED_KEY"            "FWA_WATERSHED_CODE"      
 [9] "LOCAL_WATERSHED_CODE"     "WATERSHED_GROUP_CODE"     "DOWNSTREAM_ROUTE_MEASURE" "LENGTH_METRE"            
[13] "FEATURE_SOURCE"           "FEATURE_CODE"             "GEOMETRY"                 "OBJECTID"                
[17] "SE_ANNO_CAD_DATA"         "FEATURE_LENGTH_M"        
R> 
R> bcdc_query_geodata('2af1388e-d5f7-46dc-a6e2-f85415ddbd1c') %>% 
   select(EDGE_TYPE) %>% 
   names()
 [1] "id"                       "LINEAR_FEATURE_ID"        "WATERSHED_GROUP_ID"       "EDGE_TYPE"               
 [5] "WATERBODY_KEY"            "BLUE_LINE_KEY"            "WATERSHED_KEY"            "FWA_WATERSHED_CODE"      
 [9] "LOCAL_WATERSHED_CODE"     "WATERSHED_GROUP_CODE"     "DOWNSTREAM_ROUTE_MEASURE" "LENGTH_METRE"            
[13] "FEATURE_SOURCE"           "FEATURE_CODE"             "GEOMETRY"                 "OBJECTID"                
[17] "SE_ANNO_CAD_DATA"         "FEATURE_LENGTH_M"      

@ateucher
Copy link
Collaborator

@boshek I love the idea!

@boshek
Copy link
Collaborator Author

boshek commented Aug 25, 2021

This works now:

R> bcdc_query_geodata('2af1388e-d5f7-46dc-a6e2-f85415ddbd1c') %>% 
   names()
 [1] "id"                       "LINEAR_FEATURE_ID"        "WATERSHED_GROUP_ID"      
 [4] "EDGE_TYPE"                "WATERBODY_KEY"            "BLUE_LINE_KEY"           
 [7] "WATERSHED_KEY"            "FWA_WATERSHED_CODE"       "LOCAL_WATERSHED_CODE"    
[10] "WATERSHED_GROUP_CODE"     "DOWNSTREAM_ROUTE_MEASURE" "LENGTH_METRE"            
[13] "FEATURE_SOURCE"           "FEATURE_CODE"             "OBJECTID"                
[16] "SE_ANNO_CAD_DATA"         "FEATURE_LENGTH_M"         "geometry"                
R> bcdc_query_geodata('2af1388e-d5f7-46dc-a6e2-f85415ddbd1c') %>% 
   select(EDGE_TYPE) %>% 
   names()
 [1] "id"                   "LINEAR_FEATURE_ID"    "WATERSHED_GROUP_ID"   "EDGE_TYPE"           
 [5] "WATERSHED_GROUP_CODE" "LENGTH_METRE"         "FEATURE_SOURCE"       "FEATURE_CODE"        
 [9] "OBJECTID"             "geometry"      

@boshek boshek marked this pull request as ready for review August 26, 2021 20:18
@boshek
Copy link
Collaborator Author

boshek commented Aug 26, 2021

@ateucher - I don't think these failures are related to this PR.

Copy link
Collaborator

@ateucher ateucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Just one super minor suggestion, otherwise I think it's good to merge. Thanks for doing this!

R/utils-classes.R Outdated Show resolved Hide resolved
@boshek boshek merged commit 5cfbdb4 into master Sep 8, 2021
@boshek boshek deleted the names branch September 8, 2021 18:05
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

Successfully merging this pull request may close these issues.

2 participants