[BioC] Functions

Steve Lianoglou lianoglou.steve at gene.com
Tue Jun 11 20:07:11 CEST 2013


Hi,

On Tue, Jun 11, 2013 at 7:23 AM, James W. MacDonald <jmacdon at uw.edu> wrote:
> Hi Steve,
>
>
> On 6/10/2013 7:36 PM, Steve Lianoglou wrote:
>>
>> ... au contraire mon frere ...
>>
>> On Mon, Jun 10, 2013 at 2:06 PM, James W. MacDonald<jmacdon at uw.edu>
>> wrote:
>> [snip]
>>>>
>>>>           Data<- ReadAffy( sampleNames=as.character( Cov$Label
>>>> ),phenoData=tmp, verbose=TRUE )
>>>> }
>>>
>>>
>>> This function doesn't return anything. You can end the function in one of
>>> three ways. The last lines can be
>>
>> As the opportunity to correct Jim doesn't arise too often, you've got
>> to keep your sense sharp and your keyboard ready plugged in.
>>
>> R>  nothing<- function(x) {
>>    y<- x + 10
>> }
>>
>> R>  something<- nothing(10)
>> R>  something
>> [1] 20
>
>
> Hrmm. Grumble grumble grumble.
>
> Oddly enough (to me at least) what you say is true. Howeva, it is dependent
> on assignment to an object:
>
>
>> nothing <- function(x) y <- x+10
>> nothing(10)
>> something <- nothing(10)
>> something
> [1] 20
>> nothing2 <- function(x) {
> + y <- x+10
> + y
> + }
>> nothing2(10)
> [1] 20

Indeed -- it kind of feels like ending a function with an assignment
is almost like returning "that thing" invisibly, though I'm not quite
sure what (if any) the differences are.

Anyway, apologies if I've derailed a helpful reply a bit too far by
jumping in with some random R bar trivia.

-steve

--
Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology
Genentech



More information about the Bioconductor mailing list