>> Hi >> >> I inherited a R package done in 2004 that works perfectly in R 2.15.1 >> and before, but not in R 3.2.2 ( >= 3). >> >> I have already fixed issues with namespace for functions in R 3 but >> maybe not all of them. >> >> Here is the error message: >> Error in .Call("R_cutree", tree$merge, k, PACKAGE = "stats") >> "R_cutree" not available for .Call() for package "stats" > > Why do you .Call() into another package? Rather use the API.Let's say that I am far from a R master. I never use .Call() myself. I want the code works again in R >= 3 because R support for R 2 will soon be stopped in my institute. When the code will work again, I could change internals by comparing results with R 2 and R 3.> Best, > Uwe Ligges > >> >> Thanks for your help-- S?bastien Moretti
On 08.03.2016 14:55, Sebastien Moretti wrote:>>> Hi >>> >>> I inherited a R package done in 2004 that works perfectly in R 2.15.1 >>> and before, but not in R 3.2.2 ( >= 3). >>> >>> I have already fixed issues with namespace for functions in R 3 but >>> maybe not all of them. >>> >>> Here is the error message: >>> Error in .Call("R_cutree", tree$merge, k, PACKAGE = "stats") >>> "R_cutree" not available for .Call() for package "stats" >> >> Why do you .Call() into another package? Rather use the API. > > Let's say that I am far from a R master. > I never use .Call() myself. > > I want the code works again in R >= 3 because R support for R 2 will > soon be stopped in my institute. > When the code will work again, I could change internals by comparing > results with R 2 and R 3.Well, the error message above suggets you have R code that uses .Call() not compatible with the R version you are using. I do not know where the .Call() comes from, ehnce your turn to find it out. You haven?t given any other information, not even a traceback(). Best, Uwe Ligges> >> Best, >> Uwe Ligges >> >>> >>> Thanks for your help > > -- > S?bastien Moretti >
cutree is a function available in stats.
So it might be worth a try to just replace
.Call("R_cutree", tree$merge, k, PACKAGE = "stats?)
by
cutree(tree$merge,k)
and see what happens.
checking the source of cutree shows the following call
ans <- .Call(C_cutree, tree$merge, k)
so replacing R_cutree by C_cutree also might be an option.
But, of course as Uwe recommended,
using a plain R call and not using .Call is the preferred solution.
> On Mar 8, 2016, at 14:55, Sebastien Moretti <sebastien.moretti at
unil.ch> wrote:
>
>>> Hi
>>>
>>> I inherited a R package done in 2004 that works perfectly in R
2.15.1
>>> and before, but not in R 3.2.2 ( >= 3).
>>>
>>> I have already fixed issues with namespace for functions in R 3 but
>>> maybe not all of them.
>>>
>>> Here is the error message:
>>> Error in .Call("R_cutree", tree$merge, k, PACKAGE =
"stats")
>>> "R_cutree" not available for .Call() for package
"stats"
>>
>> Why do you .Call() into another package? Rather use the API.
>
> Let's say that I am far from a R master.
> I never use .Call() myself.
>
> I want the code works again in R >= 3 because R support for R 2 will
soon be stopped in my institute.
> When the code will work again, I could change internals by comparing
results with R 2 and R 3.
>
>> Best,
>> Uwe Ligges
>>
>>>
>>> Thanks for your help
>
> --
> S?bastien Moretti
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 670 bytes
Desc: Message signed with OpenPGP using GPGMail
URL:
<https://stat.ethz.ch/pipermail/r-help/attachments/20160308/70835d1c/attachment.bin>
Hi Using cutree(tree$merge, k) fixed the problem. In fact had to use cutree(tree["merge"], k) Will compare results in R 2 and R 3 now. Thanks for your help. S?bastien> cutree is a function available in stats. > So it might be worth a try to just replace > > .Call("R_cutree", tree$merge, k, PACKAGE = "stats?) > > by > > cutree(tree$merge,k) > > and see what happens. > > checking the source of cutree shows the following call > > ans <- .Call(C_cutree, tree$merge, k) > > so replacing R_cutree by C_cutree also might be an option. > But, of course as Uwe recommended, > using a plain R call and not using .Call is the preferred solution. > > >> On Mar 8, 2016, at 14:55, Sebastien Moretti <sebastien.moretti at unil.ch> wrote: >> >>>> Hi >>>> >>>> I inherited a R package done in 2004 that works perfectly in R 2.15.1 >>>> and before, but not in R 3.2.2 ( >= 3). >>>> >>>> I have already fixed issues with namespace for functions in R 3 but >>>> maybe not all of them. >>>> >>>> Here is the error message: >>>> Error in .Call("R_cutree", tree$merge, k, PACKAGE = "stats") >>>> "R_cutree" not available for .Call() for package "stats" >>> >>> Why do you .Call() into another package? Rather use the API. >> >> Let's say that I am far from a R master. >> I never use .Call() myself. >> >> I want the code works again in R >= 3 because R support for R 2 will soon be stopped in my institute. >> When the code will work again, I could change internals by comparing results with R 2 and R 3. >> >>> Best, >>> Uwe Ligges >>> >>>> >>>> Thanks for your help-- S?bastien Moretti