Giter Club home page Giter Club logo

Comments (6)

lf-araujo avatar lf-araujo commented on July 20, 2024

@mhunter1, @RMKirkpatrick I need help on finalizing the pull request, I was about add a test unit for the PR, but I noticed that if i add:

`+.MxModel`  <- function (e1, e2) { 
  mxModel(e1, e2)
}

to MxModel.R, then build with make install and then run my tests, the new overloading is not being picked up and the test errs. Am I adding that code to the wrong place?

My test file looks like the following:

library(OpenMx)
library(testthat)
context("Plus operator")


mb <- mxModel("bivariate Heterogeneity Path Specification",
  type = "RAM",
  manifestVars = c("X", "Y")
) +
  mxPath(from = c("X", "Y"), arrows = 2, free = T, values = 1, lbound = .01) +
  mxPath(from = "X", to = "Y", arrows = 2, free = T, values = .2, lbound = .01) +
  mxPath(
    from = "one", to = c("X", "Y"), arrows = 1, free = T, values = c(0.1, -0.1),
    ubound = c(NA, 0), lbound = c(0, NA)
  )

mb <- mxGenerateData(mb, nrows = 1000, returnModel = T)
out <- try(mxRun(mb))

omxCheckEquals(is(out, "try-error"), FALSE)

The error:

image

from openmx.

lf-araujo avatar lf-araujo commented on July 20, 2024

On a second thought, I remember in R one needs to export a new function in order to be available to the user, otherwise it is just for internal use, is that it?

from openmx.

RMKirkpatrick avatar RMKirkpatrick commented on July 20, 2024

On a second thought, I remember in R one needs to export a new function in order to be available to the user, otherwise it is just for internal use, is that it?

Yes, I think you'll need to add the appropriate line to the NAMESPACE file.

from openmx.

lf-araujo avatar lf-araujo commented on July 20, 2024

Ok, done.

Will move on to #351 and then back. Thanks for the help.

from openmx.

tbates avatar tbates commented on July 20, 2024

You can also use roxygen to document, handle the namespace etc. in-line. Some OpenMx functions use this, most hand-write it all. It's a bit of a doctrinaire issue :-)

This is a stub I use, but you can learn more by searching #' in the code or https://roxygen2.r-lib.org

#' TITLE
#'
#' @description myfunc is a function which
#'
#' @details If any
#'
#' @param param a something to DO WHAT?
#' @return - what i return
#' @export
#' @family
#' @Seealso - [omxSimilarFunction()]
#' @references - if any
#' @md
#' @examples
#' myfunc(param)
#' \dontrun{
#'
#' }

from openmx.

lf-araujo avatar lf-araujo commented on July 20, 2024

from openmx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.