-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMod07_function.R
87 lines (69 loc) · 1.33 KB
/
Mod07_function.R
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
#################################################
# Company : Stevens
# Project : R Bootcamp
# Purpose : Function
# First Name : Khasha
# Last Name : Dehnad
# Id : 12345
# Date :
# Comments :
rm(list=ls())
#################################################
## Step:
##
##
##
##
##
##
##
##
##
##
##
##
######################
## Define a funcition!!!
mmnorm <-function(x,minx,maxx)
{z<-((x-minx)/(maxx-minx))
return(z)
}
mmnorm2 <-function(x)
{z<-((x-min(x))/(max(x)-min(x)))
return(z)
}
myvector<-1:20
mmnorm2(myvector)
myvector<-1:20
mmnorm(myvector,min(myvector),max(myvector))
maxx<-20
minx<-1
mmnorm4 <-function(x)
{
minx<-10
z<-((x-minx)/(maxx-minx))
y<-list(z,minx,maxx)
return(y)
}
results<-mmnorm4(myvector)
length(results)
results[1]
results[2]
results[3]
minx
maxx
mmnorm3 <-function(x)
{z<-((x-min(x))/(max(x)-min(x)))
return(z)
}
mmnorm3(myvector)
f_print <-function(x1,x2,x3,x4,x5)
{
print(c('value of x1',x1))
print(c('value of x2',x2))
print(c('value of x3',x3))
print(c('value of x4',x4))
print(c('value of x5',x5))
}
f_print(10,5,3,2,1)
f_print(x2=10,x5=5,3,2,1)