wincowgerDEV / OpenSpecy-package

Analyze, Process, Identify, and Share, Raman and (FT)IR Spectra
http://wincowger.com/OpenSpecy-package/
Creative Commons Attribution 4.0 International
23 stars 11 forks source link

[Feature]: A way to print the function code to the console by default #121

Closed wincowgerDEV closed 1 year ago

wincowgerDEV commented 1 year ago

Guidelines

Description

A user was trying to print the raw function to the console to inspect it and expected that it would print the raw function code with a call like below.

match_spec()

But the code just referenced another function.

Problem

No

Proposed Solution

Make the below code print the raw function by default.

match_spec()

Alternatives Considered

No

zsteinmetz commented 1 year ago

This is a side effect of S3 methods and cannot be avoided; see https://stackoverflow.com/questions/19226816/how-can-i-view-the-source-code-for-a-function for details.

To look at the code anyway, use the following commands:

methods(match_spec)
OpenSpecy:::match_spec.default

The first line lists all methods of the function. The second line is used to get the code of one particular method, here the default one. Don't forget to put three colons after the package name.