Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

S3method: Register S3 Methods

S3methodR Documentation

Register S3 Methods

Description

Register S3 methods in R scripts.

Usage

.S3method(generic, class, method)

Arguments

generic

a character string naming an S3 generic function.

class

a character string naming an S3 class.

method

a character string or function giving the S3 method tobe registered. If not given, the function namedgeneric.class is used.

Details

This function should only be used in R scripts: for package code, oneshould use the correspondingS3methodNAMESPACE’ directive.

Examples

## Create a generic function and register a method for objects## inheriting from class 'cls':gen <- function(x) UseMethod("gen")met <- function(x) writeLines("Hello world.").S3method("gen", "cls", met)## Create an object inheriting from class 'cls', and call the## generic on it:x <- structure(123, class = "cls")gen(x)

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp