1 Zakład Bioinformatyki, Instytut Informatyki, Uniwersytet w Białymstoku
✉ Correspondence: Jarosław Kotowicz <j.kotowicz@uwb.edu.pl>
0.1 * 0.1 == 0.01
[1] FALSE
<- 1
x x
[1] 1
<- c(1, 25, 7)
v1 v1
[1] 1 25 7
typeof(x)
[1] "double"
mode(x)
[1] "numeric"
class(x)
[1] "numeric"
<- c(TRUE, FALSE)
v2 v2
[1] TRUE FALSE
<- c(T, F)
v3 v3
[1] TRUE FALSE
typeof(v2)
[1] "logical"
class(v2)
[1] "logical"
mode(v2)
[1] "logical"
is.logical(v2)
[1] TRUE
is.logical(x)
[1] FALSE
<- 1L z
typeof(z)
[1] "integer"
class(z)
[1] "integer"
mode(z)
[1] "numeric"
+ x v1
[1] 2 26 8
<- c(1:2)
v4 + v4 v1
długość dłuższego obiektu nie jest wielokrotnością długości krótszego obiektu
[1] 2 27 8
/ 2 v2
[1] 0.5 0.0
2 * TRUE
[1] 2
2 * FALSE
[1] 0
3 == TRUE
[1] FALSE
<- c("napis", "to", "ja")
z z
[1] "napis" "to" "ja"
paste(z, collapse = " ")
[1] "napis to ja"
<- factor(c("zły", "dobry"))
f1 f1
[1] zły dobry
Levels: dobry zły
typeof(f1)
[1] "integer"
mode(f1)
[1] "numeric"
class(f1)
[1] "factor"
<- factor(c("zły", "dobry"), ordered = TRUE)
f2 f2
[1] zły dobry
Levels: dobry < zły
typeof(f2)
[1] "integer"
mode(f2)
[1] "numeric"
class(f2)
[1] "ordered" "factor"
<- factor(c("zły", "dobry"), levels = c("zły", "dobry"), ordered = TRUE)
f3 f3
[1] zły dobry
Levels: zły < dobry
<- list(litery = letters, cyfry = 0:9, logiczne = c(TRUE, FALSE))
l1 l1
$litery
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
$cyfry
[1] 0 1 2 3 4 5 6 7 8 9
$logiczne
[1] TRUE FALSE
typeof(l1)
[1] "list"
mode(l1)
[1] "list"
class(l1)
[1] "list"
is.atomic(l1)
[1] FALSE
is.recursive(l1)
[1] TRUE
<- list(l1, imiona = c("Adam", "Ewa"), nazwiska = c("Kowalski", "Nowak"))
l2 l2
[[1]]
[[1]]$litery
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
[[1]]$cyfry
[1] 0 1 2 3 4 5 6 7 8 9
[[1]]$logiczne
[1] TRUE FALSE
$imiona
[1] "Adam" "Ewa"
$nazwiska
[1] "Kowalski" "Nowak"
<- array(rnorm(100), c(10, 5, 2))
a1 a1
, , 1
[,1] [,2] [,3] [,4] [,5]
[1,] 1.38386301 -0.5291288 -0.3879402 -0.25278199 -0.15617925
[2,] 0.41036156 0.5319073 1.8455044 0.26837547 1.13910214
[3,] 0.04684133 0.2285078 -0.1272259 -0.63439106 0.50874156
[4,] 0.53981438 0.1644592 1.4775694 -0.89615459 0.11810905
[5,] 0.75953487 0.4690186 1.9153122 0.37289431 1.01342012
[6,] 1.68393299 -1.7487418 0.7112948 0.68004825 -0.16661938
[7,] -2.11945092 1.5572583 0.4054456 -0.11984787 0.56231813
[8,] 0.54284224 -1.8590479 0.1164868 0.44174336 -0.22827804
[9,] -1.34492388 1.2664027 -1.3167933 0.02160616 0.04368969
[10,] -0.28355945 -0.3552558 -0.1029444 -0.57871159 -0.38364071
, , 2
[,1] [,2] [,3] [,4] [,5]
[1,] 1.4539201 1.64063372 0.52201056 -1.3989100 -0.14317466
[2,] 0.6639905 0.35720029 -0.47125299 -0.7600393 0.08980089
[3,] -1.2119809 -1.71161006 0.60703332 0.9986382 -0.10565636
[4,] -1.1593771 -0.14008148 0.18827706 0.4306923 0.94462658
[5,] 1.1886310 0.02925152 0.80984226 0.6909916 -1.51266805
[6,] 0.5368452 -0.37967244 -0.86874601 -1.5706242 0.41821365
[7,] 2.0893560 0.53252561 0.64773414 1.4461651 -0.33572958
[8,] 0.3612782 -0.32884538 -0.10814663 1.6454971 0.18524837
[9,] 0.4805084 0.57921196 -1.06489700 0.9362112 -0.90597064
[10,] -0.6519389 -1.87521890 0.01973623 -0.2948808 0.18746580
typeof(a1)
[1] "double"
mode(a1)
[1] "numeric"
class(a1)
[1] "array"
<- matrix(rnorm(100), ncol = 10, nrow = 10)
m1 m1
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] -0.37821449 -0.1518669 1.00046581 0.07565567 -0.88222732 -1.3789073 1.56487967 -0.1013237 1.12998917 -0.02642563
[2,] 1.92064707 0.1345935 -0.01050935 0.50974430 -0.44559790 -1.3152171 0.04956862 0.7814998 -2.21515807 -1.49686329
[3,] -0.53099172 -1.2601387 -0.14822469 0.76105837 -1.36320851 1.0576217 -1.98593563 0.2456150 -0.68280088 -0.83517938
[4,] -0.12465193 1.1429696 2.47718043 -0.24174876 -2.02076798 -0.4202247 -1.18895750 -0.1156164 -1.24545437 -0.55813466
[5,] -0.78185244 -0.1224754 -0.45427055 0.16992759 0.56778292 1.8874210 0.48647843 0.7741051 0.38538470 -1.10222541
[6,] 0.81679687 0.9689758 0.58929564 0.92260083 1.78742116 -0.8899874 0.29356212 0.8202191 -0.85326371 -0.25197820
[7,] 0.40980333 -0.8940717 -0.50425854 -0.72904199 -0.08027053 -0.6676902 0.31518259 0.6444782 0.83744764 -1.06517821
[8,] -0.80164231 0.1804351 1.45521736 1.07148373 -0.67298531 0.3987343 -0.85489285 -1.4448775 -0.09042728 0.15774196
[9,] 0.02706468 0.4692385 0.12662650 -1.18959571 0.78837063 -0.0802130 0.57580836 0.9524794 -1.17914212 0.55757489
[10,] -0.91424190 0.3165340 -0.32293676 0.87819771 -0.85628815 2.0632735 -1.13635788 -0.9388210 -1.03002159 -0.14659916
typeof(m1)
[1] "double"
mode(m1)
[1] "numeric"
class(m1)
[1] "matrix" "array"
<- abs(m1)
m2 m2
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0.37821449 0.1518669 1.00046581 0.07565567 0.88222732 1.3789073 1.56487967 0.1013237 1.12998917 0.02642563
[2,] 1.92064707 0.1345935 0.01050935 0.50974430 0.44559790 1.3152171 0.04956862 0.7814998 2.21515807 1.49686329
[3,] 0.53099172 1.2601387 0.14822469 0.76105837 1.36320851 1.0576217 1.98593563 0.2456150 0.68280088 0.83517938
[4,] 0.12465193 1.1429696 2.47718043 0.24174876 2.02076798 0.4202247 1.18895750 0.1156164 1.24545437 0.55813466
[5,] 0.78185244 0.1224754 0.45427055 0.16992759 0.56778292 1.8874210 0.48647843 0.7741051 0.38538470 1.10222541
[6,] 0.81679687 0.9689758 0.58929564 0.92260083 1.78742116 0.8899874 0.29356212 0.8202191 0.85326371 0.25197820
[7,] 0.40980333 0.8940717 0.50425854 0.72904199 0.08027053 0.6676902 0.31518259 0.6444782 0.83744764 1.06517821
[8,] 0.80164231 0.1804351 1.45521736 1.07148373 0.67298531 0.3987343 0.85489285 1.4448775 0.09042728 0.15774196
[9,] 0.02706468 0.4692385 0.12662650 1.18959571 0.78837063 0.0802130 0.57580836 0.9524794 1.17914212 0.55757489
[10,] 0.91424190 0.3165340 0.32293676 0.87819771 0.85628815 2.0632735 1.13635788 0.9388210 1.03002159 0.14659916
<- m1^2
m3 m3
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0.1430461975 0.02306355 1.0009318356 0.005723781 0.778325044 1.901385309 2.448848383 0.01026649 1.276875534 0.000698314
[2,] 3.6888851738 0.01811542 0.0001104463 0.259839255 0.198557491 1.729795985 0.002457048 0.61074197 4.906925271 2.240599720
[3,] 0.2819522087 1.58794951 0.0219705581 0.579209843 1.858337437 1.118563659 3.943940313 0.06032672 0.466217041 0.697524595
[4,] 0.0155381041 1.30637940 6.1364228617 0.058442463 4.083503222 0.176588781 1.413619932 0.01336715 1.551156589 0.311514294
[5,] 0.6112932308 0.01500023 0.2063617297 0.028875386 0.322377440 3.562358072 0.236661258 0.59923878 0.148521369 1.214900851
[6,] 0.6671571229 0.93891410 0.3472693541 0.851192300 3.194874408 0.792077485 0.086178716 0.67275945 0.728058951 0.063493012
[7,] 0.1679387664 0.79936412 0.2542766704 0.531502229 0.006443359 0.445810205 0.099340063 0.41535212 0.701318558 1.134604626
[8,] 0.6426303969 0.03255682 2.1176575511 1.148077381 0.452909233 0.158989050 0.730841787 2.08767099 0.008177094 0.024882525
[9,] 0.0007324967 0.22018479 0.0160342705 1.415137963 0.621528245 0.006434126 0.331555273 0.90721694 1.390376149 0.310889758
[10,] 0.8358382481 0.10019375 0.1042881497 0.771231219 0.733229401 4.257097701 1.291309236 0.88138486 1.060944478 0.021491315
<- m1 * m1
m4 m4
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0.1430461975 0.02306355 1.0009318356 0.005723781 0.778325044 1.901385309 2.448848383 0.01026649 1.276875534 0.000698314
[2,] 3.6888851738 0.01811542 0.0001104463 0.259839255 0.198557491 1.729795985 0.002457048 0.61074197 4.906925271 2.240599720
[3,] 0.2819522087 1.58794951 0.0219705581 0.579209843 1.858337437 1.118563659 3.943940313 0.06032672 0.466217041 0.697524595
[4,] 0.0155381041 1.30637940 6.1364228617 0.058442463 4.083503222 0.176588781 1.413619932 0.01336715 1.551156589 0.311514294
[5,] 0.6112932308 0.01500023 0.2063617297 0.028875386 0.322377440 3.562358072 0.236661258 0.59923878 0.148521369 1.214900851
[6,] 0.6671571229 0.93891410 0.3472693541 0.851192300 3.194874408 0.792077485 0.086178716 0.67275945 0.728058951 0.063493012
[7,] 0.1679387664 0.79936412 0.2542766704 0.531502229 0.006443359 0.445810205 0.099340063 0.41535212 0.701318558 1.134604626
[8,] 0.6426303969 0.03255682 2.1176575511 1.148077381 0.452909233 0.158989050 0.730841787 2.08767099 0.008177094 0.024882525
[9,] 0.0007324967 0.22018479 0.0160342705 1.415137963 0.621528245 0.006434126 0.331555273 0.90721694 1.390376149 0.310889758
[10,] 0.8358382481 0.10019375 0.1042881497 0.771231219 0.733229401 4.257097701 1.291309236 0.88138486 1.060944478 0.021491315
<- m1 %*% m1
m5 colSums(m4)
[1] 7.055012 5.041722 10.205323 5.649232 12.250085 14.149100 10.584752 6.258325 12.238571 6.020599
rowSums(m4)
[1] 7.589164 13.656028 10.615992 15.066533 6.945588 8.341975 4.555951 7.404393 5.220090 10.057008
colMeans(m4)
[1] 0.7055012 0.5041722 1.0205323 0.5649232 1.2250085 1.4149100 1.0584752 0.6258325 1.2238571 0.6020599
rowMeans(m4)
[1] 0.7589164 1.3656028 1.0615992 1.5066533 0.6945588 0.8341975 0.4555951 0.7404393 0.5220090 1.0057008
<- data.frame(lzp = rnorm(10),
df1 lc = sample(1:100, 10),
wl = sample(c(TRUE, FALSE), 10, replace = TRUE),
zf = sample(factor(c("K", "M")), 10, replace = TRUE))
df1
summary(df1)
lzp lc wl zf
Min. :-1.5075 Min. :12.00 Mode :logical K:6
1st Qu.:-0.9073 1st Qu.:42.50 FALSE:4 M:4
Median :-0.3529 Median :63.00 TRUE :6
Mean :-0.3423 Mean :56.10
3rd Qu.: 0.0518 3rd Qu.:75.25
Max. : 1.2415 Max. :93.00