# 2- vmr package first step

# To Start

    #install.packages(c('vmr'))
    library(vmr)
    vmrSetVerbose("Full")

## List available environment (boxes)

Boxes are listed from https://app.vagrantup.com/VMR/.
Mainly you’ve got the OS, the R version installed (follow by a timestamp) and the provider available.

    list_boxes <- vmrList()
    print(list_boxes)

## Create a vmr object

To create a minimal vmr object you need the name and the provider of a box (default version is “latest”).

    index <- which(list_boxes$Name == "LinuxMint20-R")[1]
    vmr_env <- vmrCreate(name = list_boxes$Name[index], provider = list_boxes$Provider[1])
    vmr_env

## Initialize the vmr environment

> Environment configuration depend of a directory (the working directory) and a file template call Vagrantfile.
> This function have to be re-call if vmr_env object is modified.
> When initializing environment the box with same name, version and provider, will be download once. It can be long depending of the box size and network bandwide. The box is save in vagrant environment (“~/.vagrant.d/”).

    vmr_env <- vmrInitEnv(vmr_env)

> Note : when vmr environment is initialize, no more need to recreate vmr_env for further use (unless for specific case). Use vmrLoad() in that case to recreate the vmr object vmr_env.

## Start vmr environment

To start an environment:
> This start the virtual environment using the vmr directory and the Vagrantfile template.
Be sure to always be in the same working directory.

    vmrStart()

Now enjoy using R console, the virtual environment GUI or both.

To get vmr Status:

    vmrStatus()

## Stop vmr environment

To save the current state and stop the environment:

    vmrSuspend()

To resume an environment previously suspended:

    vmrResume()

To stop the environment (powerOff):

    vmrStop()

# Vignettes summary

1. Working with vmr package
2. Start my first environment
3. Manage vmr environment
4. Manage boxes
5. Manage providers
6. Development with vmr
7. CI/CD
8. Functions resume

### Next vignette : 3-Manage vmr environment