Re: [R] Dynamically create a (convenience) function in a package

2023-10-30 Thread Martin Maechler
> Iris Simmons > on Mon, 30 Oct 2023 06:37:04 -0400 writes: > If you don't know the name of the attributes in advance, > how can you know the function name to be able to call it? > This seems like a very flawed approach. > Also, I would discourage the use of eval(pars

Re: [R] Dynamically create a (convenience) function in a package

2023-10-30 Thread Iris Simmons
If you don't know the name of the attributes in advance, how can you know the function name to be able to call it? This seems like a very flawed approach. Also, I would discourage the use of eval(parse(text = )), it's almost always not the right way to do what you want to do. In your case, eval(b

[R] Dynamically create a (convenience) function in a package

2023-10-30 Thread Sigbert Klinke
Hi, n a package, I have a data object with attributes, and I want to dynamically create a convenience function to access those attributes. This way, instead of using attr(x, "number"), I would like to use number(x). Because I don't know in advance which attributes the data object may have,