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

WISH: Allow for reserved symbols in variable names #16

Open
HenrikBengtsson opened this issue Aug 1, 2018 · 0 comments
Open

WISH: Allow for reserved symbols in variable names #16

HenrikBengtsson opened this issue Aug 1, 2018 · 0 comments

Comments

@HenrikBengtsson
Copy link
Owner

HenrikBengtsson commented Aug 1, 2018

Issue

We can do:

> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~tag~=binsize.rds")
  name binsize rds        pathname
1  foo     100 rds foo,tag=100.rds

But we cannot get results with columns containing reserved symbols, e.g. we cannot return a bin_size column:

> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~tag~=bin_size.rds")
Error in dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~tag~=bin_size.rds") : 
  Unexpected path(s) found:
foo,tag=100.rds

Wish

Extend the template syntax to specify such fields as well. Maybe, by backslash escaping reserved symbols, e.g.

> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~tag~=bin\\_size.rds")
  name bin_size rds        pathname
1  foo      100 rds foo,tag=100.rds

or through an unlikely filename symbol such as backtick, e.g.

> dirdf::dirdf_parse("foo,tag=100.rds", template = "name,~tag~=`bin_size`.rds")
  name bin_size rds        pathname
1  foo      100 rds foo,tag=100.rds

BTW, being able to escape as above, we can also do:

> dirdf::dirdf_parse("foo,my_tag=100.rds", template = "name,~my\\_tag~=binsize.rds")
  name binsize rds        pathname
1  foo     100 rds foo,tag=100.rds

to drop the my_tag part of the filename, rather than the tedious:

> dirdf::dirdf_parse("foo,my_tag=100.rds", template = "name,~my~_~tag~=binsize.rds")
  name binsize rds        pathname
1  foo     100 rds foo,tag=100.rds
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

No branches or pull requests

1 participant