TODO:
sv[ ignore.case('[bc]') ] doesn't work
[ ] Define (in documentation) what is a target, modifier, term, behavior/semantics, term -> modifier -> target
[ ] std: removes class from search targets
[ ] Improve searchable
function
[ ] Change ...
argument to arguments passed to the modifier?
[ ] Levenstein-based match-modifier levenshtien('term', 2) One idea is to create methods such as levenshtien2('term') ... meaning having a levenshtien distance <= 2 By defaut levenstein modifiers should order in decreasing levenstein score ... is there a way to break ties?
[ ] Parameterized match-modifiers
[ ] Delineate default vs ad-hoc searching
In Default searching, search modifiers are applied to the target. In Ad Hoc searching modifiers are applied to the search pattern.
Introduce this distinction into the docs.
For example: v[[MISS]] -> NA rather than 'named vector()'
Extract, Replace
[ ] Support data.frames
This should be straight-foward and implement a method of seachable-ANY-character that dispatches to data.frame-ANY-character after appropriate resolutions.
[ ] Support data.tables
This might be tricky as j is interpreted within x. There might not be a good way to do this unless with = FALSE. Although there might not be anything different from data.frames
[ ] Support Search Modifiers
recursive (unlist) - descend into recursive structures
[ ] Return modifiers, e.g.
multiple pattern matches reslovers:
return.modifeirs:
setting modifiers:
[ ] Plug-in architecture for search behaviors
[ ] Make it so names do not have to be quoted using qw, qcc or something
[ ] Determine if we need subclasses:
searchable.vector, searchable.list, searchable.hash
[ ] Make environments searchable
Potentially inconsistent behavior depending on whether one or more elements are matched. If one element is matched, this works as expected. If multiple matches, errors:
multiple matches for, 'i'. Use `[<-` to replace/modify multiple elements.
instructing the user to use [<-
Option 1: This is the correct behavior Option 2: no patterns applied to $<- [[<- Option 3: settable option (this is inane, since this can be overridden by the pattern match-modifier)
In order to be more like base R, it might be better to support multiple patterns. The problems is that the matching is indeterminant. This would mean that either, - OKAY: the returned object would be a different length than the patterns.
- Or, a list would be returned. Breaking the rule that [ is a slice
operator but retaining the expectation that there is one output
for every input.
- Or, elements matching ANY of the patterns would be acceptale. This might
be implemented as adding a search-modifier `Or`/`Any`, `All`
This could be handled by a return modifier such as collect
or unlist
.
OR
atomic
: force results to be atomic
recursive
, allow.recursive
/allow.list
Must the match occur for ALL patterns or ANY. Is this specifiable?
The most sensible thing is to match any of the patterns.
The alternative something ugly like: c('ay','bee','dee') %>% sapply( function(x) sv[x] ) %>% unlist( use.names = FALSE )
- Use a return-modifier that ensures a single return value.
- ? match modifiers should be resolved without necessarily affecting search etc.
- Its possible to apply the modifiers differently to searchable vs nt searchable
objects
Any modifiers to search pattern override the target.
It is unclear how lists are supported. - On [ with search miss should yield NULL (?), Cf. tests
STATUS: * When matching a pattern 0,1 or more results will be given. If no results are given a zero-lenght
BACKGROND Currently these operators support only one pattern, unlike there base counterparts. Thus, this is an error:
sv[ c('ay','bee','dee') ]
The way to seach would be:
"(ay|bee|dee)" %>% perl %>% sv[.]
No. match.modifiers are mutually exclusive.
X Option 1: Not overridden, behaves as base R. This is rationale because $ does not generally interpret the argument.
Option 2: As [[, and interprets There is no way to directly add to the structure if the Since it is object$name there can be no modifiers applied to name.
$<- ? If there is no
Follow closely stringr and use modifiers to change attributes, but have a lot of slots.
PROs: Existing interface CONs: many attributes, non-expandable, resolve at match time, object validity checking
Existing @modifiers list, overload fixed, perl, ignore,case (modifier) functions
PROs: easily extensible, write additional call-backs CONs: conflict at load, though these are compatible with stringr
Rewrite fixed, perl and ignore.case to resolve match modification at call time. Github( stringr#60 ).
Hybrid approach. - Refactor searchable with the appropriate slots.
Expand to match, search and return modifiers. Match follows closely stringr, searc
This can be implemented later
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.