User Tools

Site Tools


day1_exercise4
x = runif(10)

#1
if(sum(x)>5) {
  cat('sum(x) is greater than 5.\n')
} else if(sum(x)<5) {
  cat('sum(x) is less than 5.\n')
} else
  cat('sum(x) is equal to 5.\n')

#2
y = ifelse(x<0.5,x,x-0.5)

#3
i=3
switch(i,x+y,x-y,x*y)
day1_exercise4.txt · Last modified: 2021/03/17 13:09 by 127.0.0.1