From 5aaff9711387ce1ea1ec8ee5c5b4ecd9e1ea3dd1 Mon Sep 17 00:00:00 2001 From: leshe4ka46 Date: Tue, 11 Nov 2025 11:34:38 +0300 Subject: upd --- lab2/intro.r | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 lab2/intro.r (limited to 'lab2/intro.r') diff --git a/lab2/intro.r b/lab2/intro.r new file mode 100755 index 0000000..037210e --- /dev/null +++ b/lab2/intro.r @@ -0,0 +1,48 @@ +#!/usr/bin/env Rscript + +v <- c(1:10, seq(11, 20, by = 2)) + +typeof(1) +typeof(1L) +typeof(v) +typeof(as.integer(v)) +head(v) +str(v) +plot(v) + + +save.image(file = "abc.Rdata") + +v <- seq(1, 10, by = 0.5) +v + +load("abc.Rdata") + +v + + +v <- c("a", "b", "c", "b", "a") + +f <- factor(v) + +func <- function(x, y = 0) { + return((x * x) + y) +} + +func(y = 3, 5) + + +m <- matrix(c(1:6, 11:13), nrow = 3, ncol = 3, byrow = TRUE) +m + +m[2:3, 1:2] + +df <- data.frame(a = c(1:5), b = c("a", "b", "c", "d", "e")) + +df$a +df$b + +df[df$a > 2, ] + + +q("no") \ No newline at end of file -- cgit v1.2.3