alex_clean: alex_clean() Keeping your environment free from unnecessary...

Description Usage Arguments Value Note Examples

View source: R/alex_clean.R

Description

alex_clean() cleans either entire R global environment from all objects, Or saves specific objects aither by name or by pattern in name or both Easy way to clean the R environment from unnecessary objects and free RAM. This function is first designed by Alexander Shemetev partially inspired by maaniB. .

Usage

1
2
3
4
alex_clean(
  except = "ca1122334455667788990011",
  pattern = "ca1122334455667788990011"
)

Arguments

except

- name(s) of objects to preserve in R

pattern

- pattern in names of objects in R environment to be preserved

Value

A cleaned R environment with everything removed and selected objects preserved only (if any were asked to be preserved).

Note

Object having pattern in its name: "ca1122334455667788990011" cannot be removed with this function (if such object exists in your R environment at all). This name is reserved for undeletable object.

Examples

1
2
3
4
5
alex_clean() #cleans everything in R global environment
a = 5; b = 6; c1 = a + b; df1 = c(1, 2, 3, 4); gf1 = c(8,9,6,8); ls()
alex_clean(except = c("a", "b", "c", "d"), pattern = "df")
ls() #Your environment has only selected by user files preserved
alex_clean(pattern = "df")  #only object(s) with pattern df in name are preserved in R environment

Alexandershemetev/alexandershemetev documentation built on Dec. 30, 2020, 9:47 p.m.