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

formals() and chunk options #142

Closed
yihui opened this issue Feb 18, 2012 · 3 comments
Closed

formals() and chunk options #142

yihui opened this issue Feb 18, 2012 · 3 comments
Labels
feature Feature requests
Milestone

Comments

@yihui
Copy link
Owner

yihui commented Feb 18, 2012

@baptiste observed the similarity between formals() and chunk options, and this may bring a fundamental change to how we write chunk options (use real valid R code instead of pseudo code)

Proof of concept:

> x = 'label,a=1,b=asdf,c="qwer",d=FALSE,e=c(1,2,3)'
> z = formals(eval(parse(text = sprintf('function(%s){}', x))))
> str(z)
Dotted pair list of 6
 $ label: symbol 
 $ a    : num 1
 $ b    : symbol asdf
 $ c    : chr "qwer"
 $ d    : logi FALSE
 $ e    : language c(1, 2, 3)
@baptiste
Copy link

I've asked some advice on how best to create an alist from a character string.

@baptiste
Copy link

hadn't seen your update; I think eval(parse(text = paste("alist(", x, ")"))) is essentially equivalent. Not sure how to avoid the eval(parse)

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests
Projects
None yet
Development

No branches or pull requests

2 participants