R中的指针的解决方法? [英] Workaround for pointers in R?

查看:83
本文介绍了R中的指针的解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我一直在R中实现二叉树搜索算法,在此之前我使用了类似链接数组的结构.如果R中有指针(不是C指针,而是对对象的引用),则这些算法将容易得多.我想知道是否有解决方法.我一点也不了解S4.也许在那个框架中有可能吗?我会避免使用与环境有关的技巧,因为通过引用传递有点变通方法.而且我会避免调用C或C ++的STL.毕竟这是一个R问题.

I have been implementing binary tree search algorithm recently in R, and before that I used linked array-like structures. These algorithm would be much easier if there were pointers in R (not C pointers, but references to objects). I wonder if there is a workaround. I don't know S4 at all; maybe it is possible in that framework? I would avoid environment-related tricks, since that pass-by-reference is a little too bit of a workaround. And I would avoid invocations of C or C++'s STL. It's an R question after all.

推荐答案

R 2.12将开始为您带来一些帮助.同时,通常的建议是使用环境来近似按引用呼叫.

R 2.12 will start to bring you some of this. In the meantime, the common recommendation is to use environments to approximate call-by-reference.

这篇关于R中的指针的解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆