-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
65 lines (49 loc) · 1.58 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# lastvaluecache
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/lastvaluecache)](https://CRAN.R-project.org/package=lastvaluecache)
<!-- badges: end -->
The goal of `lastvaluecache` is to provide an efficient way to cache the results of the last evaluated expressions in R. This is particularly useful for preserving the outputs of computationally expensive operations. The package allows users to customize the number of cached values and easily retrieve them without having to recompute.
## Installation
You can install the development version of lastvaluecache like so:
``` r
# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("bquilty25/lastvaluecache")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r example, eval=F}
library(lastvaluecache)
# Run R code as usual
2 + 2
exp(1)
sin(pi / 2)
# Check the cached `.Last.value` objects
.Last.value.cache
# > .Last.value.cache
# [[1]]
# [1] 4
#
# [[2]]
# [1] 2.718282
#
# [[3]]
# [1] 1
# Set the maximum number of cached values
setMaxCachedValues(5)
# Get the maximum number of cached values
max_values <- getMaxCachedValues()
```