Saving and reloading function in a package

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Saving and reloading function in a package

Dimitrios Stasinopoulos-3
 I would like to put a graphic background to a model diagnostic plot.
The background is created with plot()/lines() but it takes time.
My solution was to save the plots as functions using splinefun().
Those saved function can be put in a .RData file using load()  or  .rds using saveRDS().

My question is how I can put those files  in a package and load them within a function of the package.
Any suggestion please?  


Prof Dimitrios Stasinopoulos
[hidden email]




--
London Metropolitan University is a limited company registered in England
and Wales with registered number 974438 and VAT registered number GB 447
2190 51. Our registered office is at 166-220 Holloway Road, London N7 8DB.
London Metropolitan University is an exempt charity under the Charities Act
2011. Its registration number with HMRC is X6880.


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Saving and reloading function in a package

David Winsemius
Isn't this much more on topic with the package development list?

--
David


> On Feb 15, 2019, at 6:37 AM, Dimitrios Stasinopoulos <[hidden email]> wrote:
>
> I would like to put a graphic background to a model diagnostic plot.
> The background is created with plot()/lines() but it takes time.
> My solution was to save the plots as functions using splinefun().
> Those saved function can be put in a .RData file using load()  or  .rds using saveRDS().
>
> My question is how I can put those files  in a package and load them within a function of the package.
> Any suggestion please?  
>
>
> Prof Dimitrios Stasinopoulos
> [hidden email]
>
>
>
>
> --
> London Metropolitan University is a limited company registered in England
> and Wales with registered number 974438 and VAT registered number GB 447
> 2190 51. Our registered office is at 166-220 Holloway Road, London N7 8DB.
> London Metropolitan University is an exempt charity under the Charities Act
> 2011. Its registration number with HMRC is X6880.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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 | Threaded
Open this post in threaded view
|

Re: Saving and reloading function in a package

Bert Gunter-2
In reply to this post by Dimitrios Stasinopoulos-3
Do what we all do and learn how to create packages by reading the "Writing
R Extensions" manual; or spend time with a tutorial that shows how various
packages or IDE's such as the RStudio IDE simplify the process. See also
?package.skeleton and other R functions that can be used to assist you.

-- Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Feb 15, 2019 at 6:10 PM Dimitrios Stasinopoulos <
[hidden email]> wrote:

>  I would like to put a graphic background to a model diagnostic plot.
> The background is created with plot()/lines() but it takes time.
> My solution was to save the plots as functions using splinefun().
> Those saved function can be put in a .RData file using load()  or  .rds
> using saveRDS().
>
> My question is how I can put those files  in a package and load them
> within a function of the package.
> Any suggestion please?
>
>
> Prof Dimitrios Stasinopoulos
> [hidden email]
>
>
>
>
> --
> London Metropolitan University is a limited company registered in England
> and Wales with registered number 974438 and VAT registered number GB 447
> 2190 51. Our registered office is at 166-220 Holloway Road, London N7 8DB.
> London Metropolitan University is an exempt charity under the Charities
> Act
> 2011. Its registration number with HMRC is X6880.
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.