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

the generic for "trimws" hides base::trimws #75

Closed
sgibb opened this issue Feb 2, 2016 · 1 comment
Closed

the generic for "trimws" hides base::trimws #75

sgibb opened this issue Feb 2, 2016 · 1 comment
Labels

Comments

@sgibb
Copy link
Collaborator

sgibb commented Feb 2, 2016

Since MSnbase 1.19.9 the import of Spectrum.xml files in synapter isn't working anymore. That happens because MSnbase maskes base::trimws by defining a new generic.

To reproduce:

Rdevel> R.version$version.str
[1] "R Under development (unstable) (2015-11-08 r69614)"
Rdevel> trimws(" xx ")
[1] "xx"
Rdevel> library("MSnbase"); packageVersion("MSnbase")
# ...
The following object is masked frompackage:base:

    trimws

[1] ‘1.19.9Rdevel> trimws(" xx ")
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for functiontrimwsfor signature"character"

IMHO there are two possible solutions:

    1. Defining a generic that uses all arguments of trimws:
# AllGenerics.R
setGeneric("trimws", function(x, which = c("both", "left", "right"))standardGeneric("trimws"))
# utils.R
setMethod("trimws", c("data.frame", "character"), function(x, which) { ... })
@sgibb sgibb added the bug label Feb 2, 2016
lgatto pushed a commit that referenced this issue Feb 2, 2016
 o Fix trimws generic/methods with useAsDefault (see issue #75)
   <2016-02-02 Tue>
 o add exprs,MSnSet-method alias (since exprs is now exported)
   <2016-02-02 Tue>
@lgatto
Copy link
Owner

lgatto commented Feb 2, 2016

Thanks - fixed in 3c07de7

@lgatto lgatto closed this as completed Feb 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants