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 "[", "[[" indexing for dictionary objects #651

Closed
koheiw opened this issue Apr 11, 2017 · 3 comments
Closed

Add "[", "[[" indexing for dictionary objects #651

koheiw opened this issue Apr 11, 2017 · 3 comments
Assignees

Comments

@koheiw
Copy link
Collaborator

koheiw commented Apr 11, 2017

Dictionary objects are not long a list of characters (or a list), so we need an extractor.

@koheiw koheiw self-assigned this Apr 11, 2017
@kbenoit
Copy link
Collaborator

kbenoit commented Apr 11, 2017

I don't understand this issue... example of what behaviour is needed?

@koheiw
Copy link
Collaborator Author

koheiw commented Apr 11, 2017

This is the current behaviour:

dict <- dictionary(list(country = c("united states", "mexico", "canada"), 
                        "law words" = c('law*', 'constitution'), 
                        freedom = c('free', "freedom", 'libertarian')))

print(dict)
print(dict[1]) # not a dictionary
dictionary(dict[1]) # does not work

but it should be

print(dict[1:2])

# Dictionary object with 5 key entries.
# - country:
#     - united states, mexico, canada
# - law words:
#     - law*, constitution

dictionary(dict[1:2])

# Dictionary object with 5 key entries.
# - country:
#     - united states, mexico, canada
# - law words:
#     - law*, constitution

@koheiw koheiw mentioned this issue Apr 11, 2017
@kbenoit kbenoit changed the title Add extractor for dictionary objects Add "[", "[[" indexing for dictionary objects Apr 11, 2017
@kbenoit
Copy link
Collaborator

kbenoit commented Apr 11, 2017

OK, now I understand. Agree this is a very useful addition.

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

No branches or pull requests

2 participants