| 1 |
getwd() |
| 2 |
setwd("mydirectory") |
| 3 |
ls() |
| 4 |
rm(objectlist) |
| 5 |
rm(x) |
| 6 |
rm(list = ls()) |
| 7 |
help(options) |
| 8 |
options() |
| 9 |
getOption("optionname") |
| 10 |
history(#) |
| 11 |
savehistory("myfile") |
| 12 |
loadhistory("myfile") |
| 13 |
save.image("myfile") |
| 14 |
save(objectlist, file="myfile") |
| 15 |
load("myfile") |
| 16 |
q() |
| 17 |
source("path/to/file.R") |
| 18 |
setwd("new/working/directory") |
| 19 |
print(x) |
| 20 |
sprintf(fmt, ...) |
| 21 |
sink(file) |
| 22 |
sink() |
| 23 |
help("function_name") |
| 24 |
#logical, integer, double, complex, character, raw равны 1 |
| 25 |
length(x) |
| 26 |
NA # Недоступное, пропущенное значение. |
| 27 |
NaN # Не число. |
| 28 |
Inf # Бесконечность. |
| 29 |
-Inf # Минус бесконечность. |
| 30 |
integer(n) |
| 31 |
double(n) |
| 32 |
numeric(n) (type double) |
| 33 |
complex(n) |
| 34 |
logical(n) |
| 35 |
character(n) |
| 36 |
raw(n) |
| 37 |
c(...) |
| 38 |
#operator : |
| 39 |
seq(from, to, by = d) |
| 40 |
seq(from, to, length = n) # Разбивает на (n - 1) равных частей. |
| 41 |
rep(x, times) # Конкатенирует times копий вектора x. |
| 42 |
rep(c(TRUE , FALSE), 3) |
| 43 |
(10:20)[c(1, 3, 5)] # Содержать индексы элементов a. |
| 44 |
(10:20)[-c(1, 3, 5)] # Исключить из вектора a, либо быть логической маской. |
| 45 |
a[idx] # Новый вектор, содержащий элементы вектора a, указанные в idx. |
| 46 |
sample(x, n, replace = FALSE, prob = NULL) |
| 47 |
sample(1:10, 5, replace = FALSE) # Replace - should sampling be with replacement? |
| 48 |
sample(1:10, 5, replace = TRUE) |
| 49 |
sample(c(0,1), 100, replace = TRUE) # 100 Bernoulli trials. |
Комментарии