[Rcpp-devel] Odd-seeming behaviour of [[ and $

North, Ben Ben.North at sig.com
Tue Oct 23 10:21:46 CEST 2012


Hi Romain,

> > Because `$` doesn't evaluate its field-name argument, is
> >
> >      field.name <- "value"
> >      do.call(`$`, list(x, field.name))
> >
> > the recommended way of accessing methods whose names are computed at
> > run-time?  It does work; just wondering if there's a better way.
>
> I don't have anything else for you.

OK, thanks; as I say, what I have works fine.

> At this stage, I would however ask myself "do I __really__ need this at
> runtime ?"

Good question :)  I /think/ it's the best way of doing what I want, but
I agree it does seem a bit clunky.

Thanks for your help.

Ben.


________________________________

Susquehanna International Group Limited

Susquehanna International Group Limited is a private company limited by shares and registered in Ireland. Registration No.: 445356. Registered Address: 4th Floor, Georges Dock House, IFSC, Dublin 1, Ireland.
Susquehanna Ireland Limited is a private company limited by shares and registered in Ireland. Registration No.: 305632. Registered Address: 4th Floor, Georges Dock House, IFSC, Dublin 1, Ireland.
Susquehanna International Securities Limited is a private company limited by shares and registered in Ireland. Registration No.: 337946. Registered Address: 4th Floor, Georges Dock House, IFSC, Dublin 1, Ireland.

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


More information about the Rcpp-devel mailing list