标签:教程 语法 简明教程 cti eth tor sort glob pytho
R 是一门用于 Data Analysis 和 Graphic 的语言。R语言同时也是一门语法极不严格的语言。
x <- c(10.4, 5.6, 3.1, 6.4, 21.7)
x
[1] 10.4 5.6 3.1 6.4 21.7
assign("y", c(1,2,3,4,5))
y
[1] 1 2 3 4 5
1/x
[1] 0.09615385 0.17857143 0.32258065 0.15625000 0.04608295
z <- c(x,0,x)
z
[1] 10.4 5.6 3.1 6.4 21.7 0.0 10.4 5.6 3.1 6.4 21.7
v <- 2*x+y+1
v
[1] 22.8 14.2 10.2 17.8 49.4
sum((x-mean(x))^2)/(length(x)-1)
[1] 53.853
x
[1] 10.4 5.6 3.1 6.4 21.7
sort(x)
[1] 3.1 5.6 6.4 10.4 21.7
v
[1] 22.8 14.2 10.2 17.8 49.4
sqrt(-17)
[1] NaN
Warning message:
In sqrt(-17) : NaNs produced
sqrt(-17+0i)
[1] 0+4.123106i
seq(0,5)
[1] 0 1 2 3 4 5
seq(0,5,0.4)
[1] 0.0 0.4 0.8 1.2 1.6 2.0 2.4 2.8 3.2 3.6 4.0 4.4 4.8
rep(x, 50)
[1] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[16] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[31] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[46] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[61] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[76] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[91] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[106] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[121] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[136] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[151] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[166] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[181] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[196] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[211] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[226] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
[241] 10.4 5.6 3.1 6.4 21.7 10.4 5.6 3.1 6.4 21.7
rep(x+x, 50)
[1] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[16] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[31] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[46] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[61] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[76] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[91] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[106] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[121] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[136] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[151] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[166] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[181] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[196] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[211] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[226] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
[241] 20.8 11.2 6.2 12.8 43.4 20.8 11.2 6.2 12.8 43.4
temp <- x > 13
temp
[1] FALSE FALSE FALSE FALSE TRUE
z <- c(1:3,NA)
z
[1] 1 2 3 NA
ind <- is.na(z)
ind
[1] FALSE FALSE FALSE TRUE
0/0
[1] NaN
labs <- paste(c("X","Y"), 1:10, "_")
labs
[1] "X 1 _" "Y 2 _" "X 3 _" "Y 4 _" "X 5 _" "Y 6 _" "X 7 _" "Y 8 _"
[9] "X 9 _" "Y 10 _"
labs <- paste(c("X","Y"), 1:10, sep="_")
labs
[1] "X_1" "Y_2" "X_3" "Y_4" "X_5" "Y_6" "X_7" "Y_8" "X_9" "Y_10"
标签:教程 语法 简明教程 cti eth tor sort glob pytho
原文地址:https://www.cnblogs.com/Neteraxe/p/14243356.html