-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.Rhistory
More file actions
151 lines (151 loc) · 6.47 KB
/
.Rhistory
File metadata and controls
151 lines (151 loc) · 6.47 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
load("~/Desktop/R programming/Variable.r")
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
help cat
help cat()
helpcat()
help cat
cat("Hello")
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/Variable.r", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R", echo=TRUE)
source("~/Desktop/R programming/String.R")
#ceil(a) --> returns the nearest greater integer to the value
cat('Ceil value of 18.2: ',ceil(18.2))
#ceiling(a) --> returns the nearest greater integer to the value
cat('Ceil value of 18.2: ',ceiling(18.2))
# abs(-15.4) --> return the absolute value ==15
cat('Absolute value of -10.5 :',abs(-10.5))
a <- c(10,20,30,40)
#max(a) --> returns the maximum value in collection a
cat('Maximum value in a: ',max(a))
#min(a) --> returns the minimum value in collection a
cat('Miniimum value in a: ',min(a))
#sqrt(a) --> returns the square root of 10
cat('Square root of 10: ',sqrt(10))
# abs(-15.4) --> return the absolute value ==15
cat('Absolute value of -10.5 :',abs(-10.5))
#floor(a) --> returns the nearest lower integer to the value
cat('Floor value of 18.5 :',floor(18.5))
#ceiling(a) --> returns the nearest greater integer to the value
cat('Ceil value of 18.2: ',ceiling(18.2))
grep('Om',name)
name <-'om Prakash'
grep('Om',name)
grep('a',name)
grep('x',name)
grep('om',name)
# grep('pattern',variable) --> return 1 if
grep('Om',name)
#nchar(var) --> returns the no of character in string or variable
cat('No of character in name: ',nchar(name))
#string concatenation --> adding two strings and creating a single string
print(paste('Hello','World')) # output --> Hello world
cat('rem of 7/10 =',7%%10)
#arithmatic operator
#1. Add(+)
cat('7 + 10 =',7+10)
#arithmatic operator
#1. Add(+)
cat('7 + 10 =',7+10)
#2. Subtraction (-)
cat('17 - 10 =',17-10)
cat('7 * 10 =',7*10)
cat('rem of 7/10 =',7%%10)
#5. Division (/)
cat('20 / 5 ='20/5)
#5. Division (/)
cat('20 / 5 =',20/5)
#3. Multiplication
cat('7 * 10 =',7*10)
20/5
30%%9
print('Value of a: ',a,'\nValue of b: ',b,'\nValue of c: ',c,'\nValue of d: ',d)
cat('-----------assignment operator: ------')
a <-3
b <<-20
40 -> c
50 ->>d
print('Value of a: ',a,'\nValue of b: ',b,'\nValue of c: ',c,'\nValue of d: ',d)
cat('Value of a: ',a,'\nValue of b: ',b,'\nValue of c: ',c,'\nValue of d: ',d)
# (a > b) --> returns true if a is greater than b. eg:- 10>9
# (a < b) --> returns true if b is greater than a. eg:- 9<10
# (a <= b) --> returns true if b is greater than or equal to b. eg 10<=10,10<=15.
# (a >= b) --> returns true if a is greater than or equal to a. eg 20 >=10,20>=20.
cat('a is equal to b: ',a==b,'\na is greater than b: ',a>b,'\n a is less than b :',a<b,'\a is greater than or equal to b:',a>=b,'a is less than or equal to b: ',a<=b)
# (a > b) --> returns true if a is greater than b. eg:- 10>9
# (a < b) --> returns true if b is greater than a. eg:- 9<10
# (a <= b) --> returns true if b is greater than or equal to b. eg 10<=10,10<=15.
# (a >= b) --> returns true if a is greater than or equal to a. eg 20 >=10,20>=20.
cat('a is equal to b: ',a==b,'\na is greater than b: ',a>b,'\n a is less than b :',a<b,'\na is greater than or equal to b:',a>=b,'a is less than or equal to b: ',a<=b)
# (a > b) --> returns true if a is greater than b. eg:- 10>9
# (a < b) --> returns true if b is greater than a. eg:- 9<10
# (a <= b) --> returns true if b is greater than or equal to b. eg 10<=10,10<=15.
# (a >= b) --> returns true if a is greater than or equal to a. eg 20 >=10,20>=20.
cat('a is equal to b: ',a==b,'\na is greater than b: ',a>b,'\n a is less than b :',a<b,'\na is greater than or equal to b:',a>=b,'\na is less than or equal to b: ',a<=b)
print('\a \b \c \d \e \f \g \h')
cat('\a', '\b', '\c', '\d', '\e', '\f',' \g', '\h')
cat('\a', '\b', '\d', '\e', '\f',' \g', '\h')
cat('\a', '\b', )
# (a == b) returns true if a equal to b else return false. eg 20==(40/2)
# (a != b) returns true if a is not equal to b else return false. eg 10 != 16
# (a > b) --> returns true if a is greater than b. eg:- 10>9
# (a < b) --> returns true if b is greater than a. eg:- 9<10
# (a <= b) --> returns true if b is greater than or equal to b. eg 10<=10,10<=15.
# (a >= b) --> returns true if a is greater than or equal to a. eg 20 >=10,20>=20.
cat('a is not equal to b:',a!=b,'\na is equal to b: ',a==b,'\na is greater than b: ',a>b,'\na is less than b :',a<b,'\na is greater than or equal to b:',a>=b,'\na is less than or equal to b: ',a<=b)
2 & 4
2 & 'om'
2 & -4
2 && -4
(2>4) & (4>2)
(2>4) && (4>2)
(2>4.2) & (4>2)
(2<4.2) & (4>2)
(2>4.2) | (4>2)
(2>4.2) || (4>2)
cat( 'a & b: ',a&b, '\na && b :', a&&b,'\na | b: ',a | b,'\na ||b :',a||b)
a <- c(20,13,49,67)
20 %in% a
10 %in% a
a <-(10:30)
print(a)
a <-(20:29)
print(a)
cat('-----------Miscellaneous operator: ------')
# (start:end) --> creates a series of number from start and end.
a <-(20:28)
b <-(15:23)
print(a)
# a %in% collection: --> returns TRUE if element present in collection else return FALSE
cat('25 is present in a: ',25 %in% a)
# matrix_a %*% matrix_b --> multiply two matrix
c <- matrix(a,3,3)
d <- matrix(b,3,3)
cat('Matrix multiplication of ',c,'and ',d,':-',c %*%d)