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

Write a function to convert a named list to the required list of arguments #53

Closed
sfcheung opened this issue Jun 15, 2020 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request top priority

Comments

@sfcheung
Copy link
Owner

sfcheung commented Jun 15, 2020

Some functions require users to specify the changes as a list of lists. E.g.,

list(list(node = "x3", rotate =  45),
      list(node = "x4", rotate = -45),
      list(node = "x2", rotate = -90))

This can be difficult to read and write. We can write a function to convert a named list, or even a named vector, to this kind of list. E.g.,

# Option A:
fct(c(x3 = 45, x4 = -45, x2 = -90)) # Return the list in the block above.
# Option B:
fct(list(x3 = 45, x4 = -45, x3 = -90)) # Return the list in the block above.

It is better to write a separate function to do this, for two reasons.

  1. This function can be be used for all other semptools functions.

  2. We do not need to modify the existing functions.

DONE

  • Drafted, to_list_of_lists. Preliminary tests passed.

  • Functions revised (preliminary tests passed).

    • rotate_resid, for the argument rotate_resid_list.

    • set_curve, for the argument curve_list.

    • set_edge_label_position, for the argument position_list.

    • set_sem_layout, for the argument indicator_push, indicator_spread, and loading_position

@sfcheung sfcheung added enhancement New feature or request low priority labels Jun 15, 2020
@sfcheung sfcheung added this to the Version 0.2.9 milestone Jun 15, 2020
@marklhc marklhc changed the title Write an function to convert a named list to the required list of arguments Write a function to convert a named list to the required list of arguments Jun 15, 2020
@sfcheung sfcheung self-assigned this Jun 27, 2020
@sfcheung
Copy link
Owner Author

Done. Functions added, revised, and tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request top priority
Projects
None yet
Development

No branches or pull requests

1 participant