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

update_list fails when new and old element is a list #201

Closed
vspinu opened this issue Jun 8, 2016 · 2 comments
Closed

update_list fails when new and old element is a list #201

vspinu opened this issue Jun 8, 2016 · 2 comments
Labels

Comments

@vspinu
Copy link
Member

@vspinu vspinu commented Jun 8, 2016

It seem to fail in the case of a transformations only:

These two work as expected:

> str(update_list(list(a = 1, b = 2), a = ~ list(a)))
List of 2
 $ a:List of 1
  ..$ : num 1
 $ b: num 2
> str(update_list(list(a = 1, b = 2), c = ~ list(a)))
List of 3
 $ a: num 1
 $ b: num 2
 $ c:List of 1
  ..$ : num 1

This one fails

> str(update_list(list(a = list(1), b = 2), a = ~ list(a)))
List of 2
 $ a:List of 1
  ..$ : num 1
 $ b: num 2

Expected result contains a doublly nested list:

> str(list(a = list(list(1)), b = 2))
List of 2
 $ a:List of 1
  ..$ :List of 1
  .. ..$ : num 1
 $ b: num 2
@hadley
Copy link
Member

@hadley hadley commented Mar 3, 2017

Seems to be a bug in the underlying modifyList()

Loading

@hadley hadley added the bug label Mar 3, 2017
@hadley
Copy link
Member

@hadley hadley commented Mar 8, 2017

Ah, no, modifyList() only replaces by name, not position. Seems reasonable to fall back to position if there are no names

Loading

@hadley hadley closed this in 51a3db9 Mar 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants