On Thu, Jun 9, 2011 at 12:27 PM, Abraham Mathew <abra...@thisorthat.com> wrote:
>
> I passed it as an argument to the function because every week I'llĀ  need to 
> add keywords to the lst, and that function will make the process more 
> automated.

But it doesn't. lst is hard-coded within your function, so passing
something, anything, named lst to your function is irrelevant.

But back to your original question, you really need to provide the
list with a short version that we can run. Diagnosing such a long mass
of code without even being able to try it out is very difficult.

Sarah

>
>
> On Thu, Jun 9, 2011 at 10:21 AM, Sarah Goslee <sarah.gos...@gmail.com> wrote:
>>
>> On Thu, Jun 9, 2011 at 11:53 AM, Abraham Mathew <abra...@thisorthat.com> 
>> wrote:
>> >
>> > lst is a list within the function.
>>
>> Then why is it passed as an argument to the function? You can have a
>> function with no arguments, but in this case why, since it would do
>> exactly the same thing every time?
>>
>> Arguments are for passing information to a function that varies each
>> time the function is run.
>>
>> Sarah
>>
>>
>> > Good point about the working directory.
>> >
>> > Thanks
>> > Abraham
>> >
>> >
>> >
>> > On Thu, Jun 9, 2011 at 9:35 AM, Sarah Goslee <sarah.gos...@gmail.com> 
>> > wrote:
>> >>
>> >> Can you boil that down into a short reproducible example?
>> >>
>> >> For instance, when you run your function at the end
>> >> > newdf <- myfunc(lst)
>> >>
>> >> I can't run it myself because I don't know what lst is. Although it seems 
>> >> not
>> >> to matter - what are you passing as an argument to the function, since
>> >> it seems to
>> >> be completely overwritten.
>> >>
>> >> Also, calling setwd() within a function seems like a bad idea, because
>> >> it guarantees that nobody but you can ever use it. And why would you,
>> >> rather than passing the working directory as an argument if it's
>> >> crucial?
>> >>
>> >> Sarah
>> >>
>> >>
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to