Packrat:快照与恢复的顺序重要吗?

Packrat: Does the order of snapshotting vs. restoring matter?

有时在使用 packrat 时,会在检查 packrat 库的状态时得到这种输出:

> packrat::status()

The following packages are tracked by packrat, but are no longer available in the local library nor present in your code:
                _      
    viridisLite   0.2.0

You can call packrat::snapshot() to remove these packages from the lockfile, or if you intend to use these packages, use packrat::restore() to restore them to your private library.

The following packages have been updated in your library, but have not been recorded in packrat:
              library   packrat
    RSQLite       2.0        NA
    blob        1.1.0        NA
    formatR       1.5        NA

Use packrat::snapshot() to record these packages in packrat.

The following packages are out of sync between packrat and your current library:
                  packrat    library
    BH           1.65.0-1   1.60.0-2
    R6              2.2.2      2.2.0
    Rcpp          0.12.13     0.12.7
    Rfacebook      0.6.17     0.6.15
    assertthat      0.2.0        0.1
    backports       1.1.1      1.0.5
    colorspace      1.3-2      1.2-6
    curl              3.0        2.1
    dplyr           0.7.4      0.5.0
    htmltools       0.3.6      0.3.5
    httr            1.3.1      1.2.1
    jsonlite          1.5        1.4
    lazyeval        0.2.1      0.2.0
    openssl         0.9.8      0.9.4
    reshape2        1.4.2      1.4.1
    scales          0.5.0      0.4.1
    stringi         1.1.5      1.1.2
    tibble          1.3.4        1.2
    yaml           2.1.14     2.1.13

Use packrat::snapshot() to set packrat to use the current library, or use
packrat::restore() to reset the library to the last snapshot.

我的问题是:运行应该先restore()还是snapshot()?我查看了 packrat 文档,但似乎没有一种方法可以执行参数化更新,即对包挑剔。

更新:
按照下面亚历克斯的建议,我收到了这个提示:

> packrat::restore()

Adding these packages to your library:
                _      
    viridisLite   0.2.0


Removing these packages from your library:
            _      
    RSQLite   2.0  
    blob      1.1.0
    formatR   1.5  
    memoise   1.1.0


Upgrading these packages in your library:
                     from         to
    BH           1.60.0-2   1.65.0-1
    R6              2.2.0      2.2.2
    Rcpp           0.12.7    0.12.13
    Rfacebook      0.6.15     0.6.17
    assertthat        0.1      0.2.0
    backports       1.0.5      1.1.1
    colorspace      1.2-6      1.3-2
    curl              2.1        3.0
    dplyr           0.5.0      0.7.4
    glue            1.1.1      1.2.0
    htmltools       0.3.5      0.3.6
    httr            1.2.1      1.3.1
    jsonlite          1.4        1.5
    lazyeval        0.2.0      0.2.1
    openssl         0.9.4      0.9.8
    reshape2        1.4.1      1.4.2
    rlang           0.1.1      0.1.4
    scales          0.4.1      0.5.0
    stringi         1.1.2      1.1.5
    tibble            1.2      1.3.4
    yaml           2.1.13     2.1.14

Do you want to continue? [Y/n]: 

答案是

我想做的是删除viridislite,而不是添加它,我想按照建议添加RSQLiteblobformatR

现在我也想知道 memoise 是怎么出现的...

这取决于你想从 packrat 得到什么。如果要加载最后一个快照,请使用 restore()。如果您更新项目中使用的包,并想制作新快照,请使用 snapshot().