43 lines
998 B
R
43 lines
998 B
R
|
age <- 22;
|
||
|
name <- "janniclas";
|
||
|
|
||
|
numbers <- seq(1:10);
|
||
|
alphabeth <- LETTERS;
|
||
|
|
||
|
# print(class(22));
|
||
|
|
||
|
even <- numbers[numbers %% 2 == 0];
|
||
|
smaller <- numbers[numbers < mean(numbers)];
|
||
|
|
||
|
# cat("Sum:", sum(numbers[numbers < mean(numbers)]), "\n");
|
||
|
# cat("Sum:", sum(numbers < mean(numbers)), "\n");
|
||
|
# cat("Correct Sum:", sum(smaller), "\n");
|
||
|
|
||
|
# print(numbers < mean(numbers));
|
||
|
|
||
|
infos <- c(name=name,age=age,sex="male");
|
||
|
print(infos["name"]);
|
||
|
|
||
|
matrix <- array(seq(1:9), dim = c(3, 3));
|
||
|
# print(class(matrix));
|
||
|
|
||
|
x <- 1:50;
|
||
|
exercise <- sapply(1:2, function(y) mean(x[y+2*(0:49)]));
|
||
|
# print(exercise);
|
||
|
|
||
|
vect <- array(rep(1, 10), 10);
|
||
|
|
||
|
x <- 1:100;
|
||
|
# print(x > 10);
|
||
|
# print(mean(x > 10));
|
||
|
# print(mean(x[x > 10]));
|
||
|
|
||
|
doomsday <- as.Date("2012-12-12");
|
||
|
doomsdays <- weekdays(seq(as.Date("0000-12-12"), by="year", length.out = 2022));
|
||
|
weekdays <- weekdays(seq(as.Date("19-02-2024"), by="days", length.out = 7));
|
||
|
|
||
|
calc <- sapply(weekdays, function(y) sum(doomsdays == y));
|
||
|
count <- calc[2];
|
||
|
|
||
|
x <- 2*(1:5);
|
||
|
print(x);
|