xoopr / r62s3 Goto Github PK
View Code? Open in Web Editor NEWAutomatic conversion of R6 public methods to S3 and S4 methods and functions.
Home Page: https://xoopR.github.io/R62S3/
License: Other
Automatic conversion of R6 public methods to S3 and S4 methods and functions.
Home Page: https://xoopR.github.io/R62S3/
License: Other
Hi, I'm trying to use this package, but I can't seem to make it work.
To reproduce what I'm seeing, create a new R project with a MyClass.R
file with the following:
#' R6 Class representing somethin
#'
#' A class representing a model.
MyClass <- R6::R6Class(
classname = "MyClass",
public = list(
#' @field a something
a = 1,
#' @description
#' prints
hello_world = function() {
cat("Hello!")
},
#' @description
#' summarizes
summary = function() {
cat("Summary!", self$a)
}
)
)
#' Creates a new model
#'
#' @return a new model
#' @export
#'
#' @examples
#' a <- my_class()
my_class <- function() {
MyClass$new()
}
Also create a zzz.R file:
# Exports public methods as S3 methods.
R62S3::R62S3(R6Class = MyClass, assignEnvir = topenv())
Then, try to run the following tests:
Restarting R session...
> devtools::load_all()
ℹ Loading testpackage
> a <- MyClass$new()
> a$hello_world()
Hello!
> hello_world.MyClass(a)
Hello!
> hello_world(a)
Error in UseMethod("hello_world", object) :
no applicable method for 'hello_world' applied to an object of class "c('MyClass', 'R6')"
> summary(a)
Error in object[[i]] : wrong arguments for subsetting an environment
So, it seems the generic is created, but it doesn't work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.