Another newbie question. I've written a function and saved the file as Xtabs.R, in a central place on a network so others will be able ot use the function, My question is how do i call this function? I've tried to chance the working directory, and tried to load it via;> library(Xtabs, lib.loc="//filer/common/technical/surveys/R_test")but neither seem to work? the function inside is called CrossTable. Mant thanks in advance [[alternative HTML version deleted]]
Hi,
Can't you just do source("Xtabs.R")? That will load in the
definition.
Alternatively, instead of saving the R program, save the workspace on your
network (e.g. Xtabs.RData), which will contain the function definition,
and arrange a link so that R always starts with that workspace loaded?
Toby Marthews
Le Mar 17 juin 2008 13:32, Michael Pearmain a ?crit :> Another newbie question.
>
> I've written a function and saved the file as Xtabs.R, in a central
place
> on
> a network so others will be able ot use the function,
> My question is how do i call this function?
>
> I've tried to chance the working directory, and tried to load it via;
>> library(Xtabs,
lib.loc="//filer/common/technical/surveys/R_test")
>
> but neither seem to work? the function inside is called CrossTable.
>
> Mant thanks in advance
It's not in a library, it is essentially just a little stored program or script Just use source() to load it and it will automatically run. Do a ls() to confirm it's there :) --- On Tue, 6/17/08, Michael Pearmain <mpearmain at google.com> wrote:> From: Michael Pearmain <mpearmain at google.com> > Subject: [R] Calling functions > To: r-help at r-project.org > Received: Tuesday, June 17, 2008, 7:32 AM > Another newbie question. > > I've written a function and saved the file as Xtabs.R, > in a central place on > a network so others will be able ot use the function, > My question is how do i call this function? > > I've tried to chance the working directory, and tried > to load it via; > > library(Xtabs, > lib.loc="//filer/common/technical/surveys/R_test") > > but neither seem to work? the function inside is called > CrossTable. > > Mant thanks in advance > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.__________________________________________________________________ [[elided Yahoo spam]]