Skip to content

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

Closed

Description

@koheiw

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

Activity

  1. self-assigned this
    on Apr 11, 2017
  2. kbenoit commented on Apr 11, 2017

    @kbenoit
    Collaborator

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

  3. koheiw commented on Apr 11, 2017

    @koheiw
    CollaboratorAuthor

    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
  4. changed the title [-]Add extractor for dictionary objects[/-] [+]Add "[", "[[" indexing for dictionary objects[/+] on Apr 11, 2017
  5. kbenoit commented on Apr 11, 2017

    @kbenoit
    Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions