-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_R_Script.R
More file actions
59 lines (38 loc) · 853 Bytes
/
Copy path01_R_Script.R
File metadata and controls
59 lines (38 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#Basic R Functions
# Show packages
# Explain about the different window
v <- c( 2,5.5,6)
t <- c(8, 3, 4)
print(v*t)
v*t
v <- c( 2,5.5,6)
t <- c(8, 3, 4)
print(v/t)
v <- c(2,5.5,6,9)
t <- c(8,2.5,14,9)
print(v>t)
# Create a vector.
x <- c('red','green',"yellow")
print(x)
# Get the class of the vector.
print(class(x))
# Create a list.
list1 <- list(c(2,5,3),21.3,sin)
# Print the list.
print(list1)
# Create a matrix.
M = matrix( c('a','a','b','c','b','a'), nrow = 2, ncol = 3, byrow = TRUE)
print(M)
# Create an array.
a <- array(c('green','yellow'),dim = c(3,3,2))
print(a)
x<- 1:15;
y<-as.vector(t(10));
z=x+y;
z
#table
year=rep(seq(1990,2016) , each=10)
name=rep(letters[1:10] , 27)
value=sample( seq(0,1,0.0001) , length(year))
data=data.frame(year, name, value)
data