Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:26:39+00:00 2026-06-10T10:26:39+00:00

Some background: I have to use function HMR from package HMR a lot. Unfortunately,

  • 0

Some background:

I have to use function HMR from package HMR a lot. Unfortunately, this function is very slow. (HMR is essentially a fitting function, which is designed to be as robust as possible, which is one reason for the lack of efficiency.) Function HMR calls function HMR::.HMR.fit1, which does the actual fitting.
Using Rprof I know that the main problem regarding efficiency is the use of lsfit, which gets called a lot. Therefore, I modified the code of .HMR.fit1 to call the C function used by lsfit directly without all the overhead of lsfit, which should result in a substantial speed gain.

Now I would like to substitute HMR::.HMR.fit1 with my modified function and test HMR if it gives the same results and how much speed I gain.

I tried to do this:

mod.fun <- function(<many args>) {
 <a lot of code>
}
environment(mod.fun) <- environment(.HMR.fit1)
.HMR.fit1 <- mod.fun 

However, HMR::.HMR.fit1 is not changed by doing this and apparently HMR::HMR does not use my modified fitting function. Is there a way to achieve what I want without building the package from source, which I cannot do due to user rights restrictions on my (windows) computer?

Right now, my solution would be to copy the code of HMR::HMR, but I hope there is a more convenient solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:26:41+00:00Added an answer on June 10, 2026 at 10:26 am

    Try

    ?assignInNamespace
    

    to replace .HMR.fit1 in the HMR package with your version.

    Possible duplicate of :

    How do I override a non-visible function in the package namespace?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have to use delayed_job (or some other background-job processor) to run jobs in
i have the following code which switches some fullscreen-background-images (fadeOut, fadeIn). setInterval(function() { var
This is a two part question, but first some background information: I have a
The background: I have a function which takes some parameters. I want to have
Background I have a pair of functions I want to use to animate some
Okay, first some background, I can't use any javascript library except YUI for this
Some background: we have a windows application (c#) that locate in the system try.
Some setup background first: I have a cronjob which runs a PHP file called
I have one AlertDialog which is working fine.I have set some background images to
In an android service I have created thread(s) for doing some background task. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.