Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create functions for using Methods #1381

Open
Felixmil opened this issue Mar 28, 2024 · 1 comment
Open

Create functions for using Methods #1381

Felixmil opened this issue Mar 28, 2024 · 1 comment

Comments

@Felixmil
Copy link
Contributor

Felixmil commented Mar 28, 2024

R users are really not used to the $ way to use methods (to be honest I don't think most of them know about the object and methods principles). So I'm suggesting we add a layer of user friendly functions that call these method under the hood.

Here's a theorical example:

createDataCombined <- function(){
   invisible(DataCombined$new())
}

addSimulationResults <- function(dataCombined, simulationResults, outputPath, names, groups){
  dataCombined$addSimulationResults(
    simulationResults = simulationResults,
    quantitiesOrPaths = outputPath,
    names = names,
    groups = groups
  )
   invisible(dataCombined)
}

...

This way, users could chain calls:

myDataCombined <-
  createDataCombined |>
  addSimulationresults(simulationResults, outputPath, names, groups) |>
  addDataSets(list(dataSet1, dataSet2), ...)
@Felixmil Felixmil changed the title Create Object initialization functions Create functions for Methods Mar 28, 2024
@Felixmil Felixmil changed the title Create functions for Methods Create functions for using Methods Mar 28, 2024
@Felixmil Felixmil changed the title Create functions for using Methods Create functions for using Methods Mar 28, 2024
@PavelBal
Copy link
Member

Yes, probably we should do it (at least for the most frequently used methods).

Though I really hate it (polluting the namespace), it will make the package more accessible for the "average" R user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants