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.



On Thu, Jun 9, 2011 at 10:21 AM, Sarah Goslee <sarah.goslee@gmail.com>wrote:

> On Thu, Jun 9, 2011 at 11:53 AM, Abraham Mathew <abraham@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.goslee@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
> >>
> >>
>

WebRep
Overall rating

	[[alternative HTML version deleted]]

