This commit is contained in:
Jakub Adamski 2021-03-11 09:33:49 +01:00
commit 300fa28b7d
3 changed files with 49 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

BIN
zajecia1/Zajęcia1.pdf Normal file

Binary file not shown.

48
zajecia1/zajecia1.R Normal file
View File

@ -0,0 +1,48 @@
# ZAD1 & ZAD2
x <- c(rep(TRUE, 3), rep(FALSE, 4), rep(TRUE, 2), rep(FALSE, 5))
y <- as.numeric(x)
#ZAD3
z <- c(seq(1, 20, by=1), rep(0, 10), seq(2, 40, by=2))
z <- c(z, rev(z))
print(z)
#ZAD4
print(letters[25])
#ZAD5
zad5 <- 1:1000
for(i in 1:length(zad5)){
if (zad5[i]%%2==0){
zad5[i]=1/zad5[i]
}
}
print(zad5)
#ZAD6
zad6 <- c(6, 3, 4, 5, 2, 3)
print(zad6[order(zad6, decreasing = TRUE)])
#ZAD7
zad7 <- c(-1.876, -1.123, -0.123, 0, 0.123, 1.123, 1.876)
znak <- vector()
zaok <- vector()
calk <- vector()
for (x in zad7){
zaok <- c(zaok, round(x, digits=2))
calk <- c(calk, floor(x))
if (x<0){
znak <- c(znak, -1)
} else if (x>0){
znak <- c(znak, 1)
} else {
znak <- c(znak, 0)
}
}
print(znak)
print(zaok)
print(calk)
#ZAD8