7

I'm building an R package for the first time and am having some trouble. I am doing an R CMD Check and am getting the following error:

get.AlignedPositions: no visible global function definition for 'subject'

I am not sure what is causing this. I don't even have a "subject" variable in my code. The code is rather lengthy so I rather not paste all of it unless someone asks in a comment. Is there something specific I should look for? The only thing I can think of is that I have a line like this:

alignment <-pairwiseAlignment(pattern = canonical.protein, subject=protein.extracted, patternQuality=patternQuality,
                            subjectQuality=subjectQuality,type = type, substitutionMatrix= substitutionMatrix,
                            fuzzyMatrix=fuzzyMatrix,gapOpening=gapOpening,gapExtension=gapExtension,
                            scoreOnly=scoreOnly)

but subject is defined by the pairwiseAlignment function in the Biostrings package. Thank you for your help!

Brian Diggs
  • 57,757
  • 13
  • 166
  • 188
user1357015
  • 11,168
  • 22
  • 66
  • 111
  • Look in your function `get.AlignedPosition`, you might be able to spot `subject` being used as a function, along the lines of `subject(foo)`. The Bioconductor [developer mailing list](http://bioconductor.org/help/mailing-list/) is designed to serve (nascent, too) Bioconductor developers. – Martin Morgan Jun 07 '12 at 05:30
  • In the function where you have this bit of code, right at the top, put in a `subject <- NA` then `rm(subject)` in the next line. Then do a build again and see what happens. – Maiasaura Jun 07 '12 at 06:04

1 Answers1

6

R spotted a function, subject, being used without a function called subject being available. One possible reason for this is explained in this discussion on R-devel. In that case code is used conditionally, e.g. if a certain package is installed we use its functionality. When checking the package on a system which does not have this package installed, we run in to these kinds of warnings. So please check if this might be the case. Alternatively, you might have made a mistake by calling subject while no function existed, e.g. subject was not a function but just an object.

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149